首页 > 代码库 > 外观模式-分层架构,方便维护遗留下的大型的系统

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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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");
    }
}

  

?
1
<br><br>