(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)