首页 > 代码库 > java设计模式_外观模式
java设计模式_外观模式
package com.wangbiao.design.facade; /** * * @Title: Client.java * @Package com.wangbiao.design.facade * @Description: TODO * @author wangbiao * @date 2014-9-20 下午03:56:08 * @version V1.0 */ public class Client { public static void main(String[] args) { Facade facade = new Facade(); facade.methodA(); facade.methodB(); } } package com.wangbiao.design.facade; /** * * @Title: Facade.java * @Package com.wangbiao.design.facade * @Description: Design Pattern-Facade * @author wangbiao * @date 2014-9-20 下午03:54:02 * @version V1.0 */ public class Facade { private SubSystemOne one; private SubSystemTwo two; private SubSystemThree three; private SubSystemFour four; public Facade() { //init one = new SubSystemOne(); two = new SubSystemTwo(); three = new SubSystemThree(); four = new SubSystemFour(); } public void methodA(){ // one,two,three one.methodOne(); two.methodTwo(); three.methodThree(); } public void methodB(){ // four,three three.methodThree(); four.methodFour(); } } class SubSystemOne{ public void methodOne(){ System.out.println("SubSystemOne"); } } class SubSystemTwo{ public void methodTwo(){ System.out.println("SubSystemTwo"); } } class SubSystemThree{ public void methodThree(){ System.out.println("SubSystemThree"); } } class SubSystemFour{ public void methodFour(){ System.out.println("SubSystemFour"); } }
java设计模式_外观模式
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。