外观模式-分层架构,方便维护遗留下的大型的系统

public class Facade {

	/**
	 * @param args 外观模式
	 */
	One one;
	Two two;
	Three three;
	
	public Facade() {
		one=new One();
		two=new Two();
		three=new Three();
	}
	
	public void Method1() {
		System.out.println("********1");
		one.methodone();
		two.methodtwo();
	}
	
	public void Methon2() {
		System.out.println("*********2");
		two.methodtwo();
		three.methodthree();
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Facade facade=new Facade();
		facade.Method1();
		facade.Methon2();
	}

}

class One{
	public void methodone() {
		System.out.println("1111");
	}
}
class Two{
	public void methodtwo() {
		System.out.println("2222");
	}
}
class Three{
	public void methodthree() {
		System.out.println("3333");
	}
}

  

posted @ 2014-04-29 11:45  蓦然回首的包子  阅读(206)  评论(0)    收藏  举报