设计模式-门面模式

 

public class System1 {
public void dosomething() {
System.out.println("system1..");
}
}

public class System2 {
public void dosomething() {
System.out.println("system2..");
}
}

public class Facade {
System1 system1 = new System1();
System2 system2 = new System2();
public void dosomething() {
system1.dosomething();
system2.dosomething();
}
}

public class Client1 {
public static void main(String[] args) {
Client1 client1 = new Client1();
client1.dosomething();
}

public void dosomething() {
Facade facade = new Facade();
facade.dosomething();
}
}

public class Client2 {
public static void main(String[] args) {
Client2 client2 = new Client2();
client2.dosomething();
}

public void dosomething() {
Facade facade = new Facade();
facade.dosomething();
}
}
上一篇:ES堆栈监测上的Logstash监控之概览,节点,管道简单汇总


下一篇:其他语言连接ES