java 设计模式
搜集的JAVA设计模式供大家参考,DOC是具体的说明,以及代码的结构.
文档片段如下:
工厂方法
你会建立一个专门生产Sample实例的工厂:
publicclassFactory{
publicstaticSamplecreator(intwhich){
//getClass生成Sample通常可使用动态类装载装入类。
if(which==1)
returnnewSampleA();
elseif(which==2)
returnnewSampleB();
}
}
GRAPH是相关的图例说明更具体化方便理解.介绍适用性和相关说明
JAVA设计模式.chm
(The collected JAVA design patterns are for your reference,
DOC is the specific instructions, and structure of the code.
The documentation snippet is as follows:
factory method
You would set up a factory dedicated to producing Sample instances:
publicclassFactory{
publicstaticSamplecreator(intwhich){
//getClass generated Sample can usually use dynamic class loading to load classes.
if(which==1)
returnnewSampleA();
elseif(which==2)
returnnewSampleB();
}
}
GRAPH is a related legend that is more specific and easy to understand. Introduces applicability and related instructions
JAVA Design Patterns.chm)
页:
[1]