摘要: 上图展示的是io流中的一个装饰者模式的代码结构 1、实现装饰器模式 汽车厂生产汽车实例,4S店可以喷漆换颜色。 1.1、公共接口 public interface Car { void skin(); } 1.2、接口实现 实现汽车出厂色 public class Corolla implement 阅读全文
posted @ 2021-11-02 22:31 BeanInJ 阅读(223) 评论(0) 推荐(0)
摘要: 1、静态代理 接口类AdminService.java接口 public interface AdminService { void update(); Object find(); } 实现类AdminServiceImpl.java public class AdminServiceImpl i 阅读全文
posted @ 2021-11-02 13:18 BeanInJ 阅读(148) 评论(0) 推荐(0)
摘要: 1、使用静态内部类实现 使用静态内部类实现单例模式,线程安全 class SingletonStaticInner { private SingletonStaticInner() {} private static class SingletonInner { private static Sin 阅读全文
posted @ 2021-11-02 10:45 BeanInJ 阅读(1132) 评论(0) 推荐(0)
/* 点击爆炸效果*/