Java代理模式
interface Subject{ void make(); } class RealSubject implements Subject{ public void make(){ System.out.println("RealSubject start"); } } class ProxySubject implements Subject{ private Subject rs; public ProxySubject(Subject s){ this.rs = s; } public void prepare(){ System.out.println("ProxySubject start"); } public void make(){ this.prepare(); rs.make(); this.destroy(); } public void destroy(){ System.out.println("ProxySubject end"); } } public class proxyDemo { public static void main(String[] args) { Subject s = new ProxySubject(new RealSubject()); s.make(); } }