知易行难啊,自己到底还有多少没有理解明白的,为什么一刨根问底,全部都哑火了?继续的设计模式,最起码常见的设计模式,要说清楚吧。
说完了代理模式,我们在理清和代理模式比较像的装饰模式,这个模式的UML为:
具体的应用是:
装饰模式中比较典型的调用方式:InputStream input = new DataInputStream(new FileInputStream(new File("")));
说到了流了,字节流和字符流在转化的时候,使用的一种模式叫做:适配器模式,典型的两个类为:(1)java.io.InputStreamReader(InputStream) inputStream 转化为 reader 接口
(2)java.io.OutputStreamWriter(OutputStream) outputStream 转化为writer接口
现在说完的常见的设计模式有:工厂,这个最简单,单例,代理,装饰,适配。还有状态机的模式,这个就不说了,在JDK里面没有体现,但是在工作流的模型中体现的比较的具体。
策略模式,这个在JDK里面有体现,比如Arrays.sort()方法,针对于比较的实现Compartor接口等等。设计模式就先说这么多,以后碰见了在继续的添加,描述。