目录标题 装饰器模式简介(Introduction to the Decorator Pattern)装饰器模式UML图模式定义与解释(Pattern Definition and Explanation) 装饰器模式中的角色与组件(Roles and Components in Decorator Pattern&#x…
一、创建型模式
创建对象的方式
1、单例模式----private static new
(1)饿汉模式【线程安全】 类加载时直接创建----直接return new的对象
public class SingleTon{private static SingleTon INSTANCE new SingleTon();private SingleTon(){}
//直接…
近期看了 mybatis 的源码,发现二级缓存这块用了装饰器模式将各个功能的缓存进行嵌套,源码上也是讲到使用了装饰器模式,但是看着跟责任链模式类似,本着搞清楚的想法,搜了很多资料,看了书籍《Head First 设计…