定义抽象Conponent
public interface HelloComponent {
String hello();
}
实现Conponent
public class HelloComponentImpl implements HelloComponent {
@Override
public String hello() {
return "Hello";
}
}
定义Decorator
public abstract class HelloDecorator implements HelloComponent{
protected HelloComponent helloComponent;
public HelloDecorator(HelloComponent helloComponent){
this.helloComponent = helloComponent;
}
}