java设计模式之装饰模式
来源:互联网 发布:软件 成本 知乎 编辑:程序博客网 时间:2024/06/05 19:26
public class Sourceable{
public void method();
}
public cass Source implements Sourceable{
@Override
public void method(){
System.out.println("this is the orginal method");
}
}
public class Decrator implements Sourceable{
private Sourceable source;
public Decrator(Sourceable source){
super();
this.source = source;
}
@Override
public void method(){
System.out.println("this is the decrator start");
source.method();
System.out.println("this is the decrator end");
}
}
public class TestDecrator{
public static void main(String[] args){
Sourceable source = new Source();
Sourceable decrator = new Decrator(source);
decrator.method();
}
}
0 0
- Java设计模式之装饰设计模式
- Java之装饰设计模式
- java设计模式之装饰
- Java设计模式之装饰模式
- Java设计模式之装饰模式
- java设计模式之装饰模式
- Java设计模式之二装饰模式
- JAVA设计模式之装饰模式
- java设计模式之装饰者模式
- java设计模式之装饰模式Decorator
- JAVA设计模式之装饰模式
- JAVA 设计模式之装饰模式
- JAVA设计模式之装饰模式
- java 设计模式之装饰模式
- Java设计模式之装饰者模式
- Java设计模式笔记之装饰模式
- Java设计模式之装饰器模式
- java 设计模式 之 装饰模式
- STL之deque
- c# BarTender打印
- springMVC 处理异常
- Mac使用zsh导致maven命令无效的解决方案
- 移动端常见的一些兼容性问题
- java设计模式之装饰模式
- mac下添加安卓开发调试设备
- Office在线预览及PDF在线预览的实现方式大集合
- 游标的使用
- Hibernate使用count(*)取得表中记录总数
- HG255D网页摄像头配置
- 友盟开发APi(统一APK数)
- 错误中学习--tomcat无法启动
- #112 – Navigating the Visual Tree in Code(在后台代码中导航可视树)