摘要:
学习动态代理模式是为了以后学习AOP(面向切面编程)打下基础,他比装饰者模式还要灵活。 我们只学习他的一个方法: Proxy.newProxyInstance(ClassLoader classLoader, Class[] interfaces, InvocationHandler invocat 阅读全文
摘要:
静态代理模式有一个很严重的缺点,就是需要生成一个代理类,很麻烦,不推荐 阅读全文
摘要:
简单画图理解 但是这段代码需要改进,因为汉堡有很多种类,薯条也有不同的类型 阅读全文
摘要:
class HungryMan { //设计模式之饿汉式,因为是static修饰的,所以是类成员, //在类被加载时就初始化对象了,不存在线程安全问题 static private HungryMan hungryMan = new HungryMan(); static HungryMan getHungryMan() { return hung... 阅读全文
摘要:
单例模式之懒汉式: 阅读全文