日期:2014-05-20 浏览次数:20763 次
public interface Sourcable { public void go(); } public class Source implements Sourcable { public void go() { System.out.println("Source method go()"); } } public class Decorator implements Sourcable { private Sourcable sourcable; public Decorator(Sourcable sourcable){ this.sourcable = sourcable; } public void go() { //这里可以有你的处理 sourcable.go(); //这里可以有你的处理 } }