- 浏览: 549149 次
- 性别:
- 来自: 杭州
文章分类
- 全部博客 (478)
- lucene (45)
- oracle (19)
- nutch (2)
- blog (2)
- 垂直搜索 (19)
- java综合 (89)
- spring (15)
- Hibernate (9)
- Struts (9)
- Hadoop (16)
- Mysql (12)
- nosql (10)
- Linux (3)
- MyEclipse (4)
- Ant (1)
- 设计模式 (19)
- JBPM (1)
- JSP (1)
- HtmlParser (5)
- SVN (2)
- 插件 (2)
- 收藏 (7)
- Others (1)
- Heritrix (18)
- Solr (4)
- 主题爬虫 (31)
- 内存数据库 (24)
- 分布式与海量数据 (32)
- httpclient (14)
- Tomcat (1)
- 面试宝典 (6)
- Python (14)
- 数据挖掘 (1)
- 算法 (6)
- 其他 (4)
- JVM (12)
- Redis (18)
最新评论
-
hanjiyun:
本人水平还有待提高,进步空间很大,看这些文章给我有很大的指导作 ...
JVM的内存管理 Ⅲ -
liuxinglanyue:
四年后的自己:这种方法 不靠谱。 使用javaagent的方式 ...
计算Java对象占用内存空间的大小(对于32位虚拟机而言) -
jaysoncn:
附件在哪里啊test.NoCertificationHttps ...
使用HttpClient过程中常见的一些问题 -
231fuchenxi:
你好,有redis,memlink,mysql的测试代码吗?可 ...
MemLink 性能测试 -
guyue1015:
[color=orange][/color][size=lar ...
JAVA同步机制
The Wikipedia example is IMHO a bit poor, lazy loading has actually completely nothing to do with the proxy pattern at all.
Flyweight (recognizeable by creational methods returning a cached instance, a bit the "multiton" idea)
Proxy (recognizeable by creational methods which returns an implementation of given abstract/interface type which in turn delegates/uses a different implementation of given abstract/interface type)
java.lang.reflect.Proxy
java.rmi.*
, the whole API actually.
Behavioral patterns
Chain of responsibility (recognizeable by behavioral methods which (indirectly) invokes the same method inanother implementation of same abstract/interface type in a queue)
Command (recognizeable by behavioral methods in an abstract/interface type which invokes a method in an implementation of a different abstract/interface type which has been encapsulated by the command implementation during its creation)
java.lang.Runnable
javax.swing.Action
Interpreter (recognizeable by behavioral methods returning a structurally different instance/type of the given instance/type; note that parsing/formatting is not part of the pattern, determining the pattern and how to apply it is)
java.util.Pattern
java.text.Normalizer
java.text.Format
javax.el.ELResolver
Iterator (recognizeable by behavioral methods sequentially returning instances of a different type from a queue)
java.util.Iterator
(thus under each also java.util.Scanner
!).java.util.Enumeration
Mediator (recognizeable by behavioral methods taking an instance of different abstract/interface type (usually using the command pattern) which delegates/uses the given instance)
java.util.Timer
(all scheduleXXX()
methods)java.util.concurrent.Executor#execute()
java.util.concurrent.ExecutorService
(the invokeXXX()
and submit()
methods)java.util.concurrent.ScheduledExecutorService
(all scheduleXXX()
methods)java.lang.reflect.Method#invoke()
Memento (recognizeable by behavioral methods which internally changes the state of the whole instance)
java.util.Date
(the setter methods do that, Date
is internally represented by a long
value)java.io.Serializable
javax.faces.component.StateHolder
Observer (or Publish/Subscribe) (recognizeable by behavioral methods which invokes a method on an instance of another abstract/interface type, depending on own state)
java.util.Observer
/java.util.Observable
(rarely used in real world though)java.util.EventListener
(practically all over Swing thus)javax.servlet.http.HttpSessionBindingListener
javax.servlet.http.HttpSessionAttributeListener
javax.faces.event.PhaseListener
State (recognizeable by behavioral methods which changes its behaviour depending on the instance's state which can be controlled externally)
java.util.Iterator
javax.faces.lifecycle.LifeCycle#execute()
(controlled by FacesServlet
, the behaviour is dependent on current phase (state) of JSF lifecycle)
Strategy (recognizeable by behavioral methods in an abstract/interface type which invokes a method in an implementation of a different abstract/interface type which has been passed-in as method argument into the strategy implementation)
java.util.Comparator#compare()
, executed by under each Collections#sort()
.javax.servlet.http.HttpServlet
, the service()
and all doXXX()
methods takeHttpServletRequest
and HttpServletResponse
and the implementor has to process them (and not to get hold of them as instance variables!).javax.servlet.Filter#doFilter()
Template method (recognizeable by behavioral methods which already have a "default" behaviour definied by an abstract type)
java.io.InputStream
, java.io.OutputStream
, java.io.Reader
and java.io.Writer
.java.util.AbstractList
, java.util.AbstractSet
andjava.util.AbstractMap
.javax.servlet.http.HttpServlet
, all the doXXX()
methods by default sends a HTTP 405 "Method Not Allowed" error to the response. You're free to implement none or any of them.
Visitor (recognizeable by two different abstract/interface types which has methods definied which takes each theother abstract/interface type; the one actually calls the method of the other and the other executes the desired strategy on it)
发表评论
-
JDK里的设计模式
2010-12-16 19:39 990Creational patterns Abst ... -
JDK里的设计模式
2010-12-16 19:35 800下面是JDK中有关23个经典设计模式的示例,在stakeo ... -
JDK里的设计模式
2010-11-28 10:42 523下面是JDK中有关23个经典设计模式的示例,在stakeo ... -
设计模式英文手稿(转)
2010-11-15 15:50 891暑期实习的时候做了一次presentation on desi ... -
推拉模式
2010-11-15 15:35 988先来比较两张 UML 图: 推模式 ... -
观察者模式
2010-11-15 15:34 1002作用: 在某一个对象的状态发生变化的时候,某些其它的 ... -
追MM与Java的23种设计模式(转)
2010-11-14 22:21 798我在Java论坛看到这篇文章,作者以轻松的语言比喻了java的 ... -
关于设计模式的非常好的站点
2010-11-14 22:10 734http://www.uml.org.cn/sjms/sjms ... -
Java设计模式之组合模式
2010-11-14 20:54 749COMPOSITE (Object Structural) P ... -
Java设计模式之观察者模式
2010-11-14 20:53 925OBSERVER (Object Behavioral) Pu ... -
Java设计模式之代理模式
2010-11-14 20:53 758PROXY (Object Structural) Purpo ... -
Java设计模式之模板方法模式
2010-11-14 20:52 802TEMPLATE METHOD (Class Behavior ... -
Java设计模式之抽象工厂模式
2010-11-14 20:51 822ABSTRACT FACTORY (Object Creati ... -
Java设计模式之状态模式
2010-11-14 20:51 913STATE (Object Behavioral) Purpo ... -
Java设计模式之策略模式
2010-11-14 20:50 912STRATEGY (Object Behavioral) P ... -
Java设计模式之装饰者模式
2010-11-14 20:49 895DECORATOR (Object Structural) P ... -
Java设计模式之单例模式
2010-11-14 20:48 818SINGLETON (Object Creational ... -
7种坏味道,11种原则,23种模式
2010-11-14 20:46 873(一)7种设计坏味道 1.僵化性: 很难对系统进行改 ...
相关推荐
JAVA设计模式在JDK中的应用JAVA设计模式在JDK中的应用 各种设计模式在JDK当中使用的地方 方便分析源码
jdk中设计模式 归纳了JDK中所包含的设计模式,包括作用和其设计类图
该文档整理了JDK中有关的设计模式,包括创建型、结构型、行为型等模式在JDK中的应用
该文档中包括了JDK中的23中设计模式的介绍,附有实例
JDK中的设计模式应用实例
设计模式在JDK中的应用课设--PPT资源 题目要求: 设计模式在JDK中的应用(结合JDK源码,分析JDK对设计模式的支持与应用)。课设内容包括: (a)用UML类图分析JDK所支持或应用的设计模式的结构,并与GOF的结构加以...
JDK中有关23个经典设计模式的示例 JDK,23个设计模式,示例,网页源码
jdk工具介绍JVM垃圾回收23种设计模式 jdk工具介绍JVM垃圾回收23种设计模式 jdk工具介绍JVM垃圾回收23种设计模式
介绍java二十三种设计模式,包括模式的描述,适用性,模式的组成部分,并附带有简单的例子和类图,目的是为了让读者了解二十三种设计模式,并能方便的查阅各种设计模式的用法及注意点,希望对大家有所帮助。...
设计模式实战、jdk源码解读等等 ok
java 23种设计模式的类图 java 23种设计模式的类图 java 23种设计模式的类图
里面包括了读观察者模式的详细介绍,这是JDK中的一个非常重要的模式。
day40 设计模式、jdk8新特性
设计模式之观察者模式Java版本实现和UML类设计图
│ 3.1江湖传言里的设计模式-单例设计模式.mp4 │ 3.2代码实战-单例设计模式中的懒汉实现方式.mp4 │ 3.4单例模式中的饿汉实现和选择问题.mp4 │ 3.5JDK源码里面的单例设计模式.mp4 │ 4.2电商支付应用案例-...
java常用设计模式及JDK与CGLIB实现动态代理区别(源码) /** * 使用cglib动态代理 * @author * */ public class BookFacadeProxy implements MethodInterceptor{ private Object target; @Override public...
设计模式之责任链模式源码 设计模式之责任链模式源码 设计模式之责任链模式源码