FactoryMethodIF { // an abstract class createProduct1 () // abstract or near empty createProduct2 () // abstract or near empty final creator () { // create products createProduct1 () createProduct2 () } } Factory_A extends FactoryMethodIF { // a concrete class createProduct1 () // specialized createProduct2 () // specialized } FactoryMethodIF factory = new Factory_A () factory.creator ()
AbstractFactoryIF { // an interface or abstract class createProduct1 () // abstract createProduct2 () // abstract } Factory_A implements AbstractFactoryIF { // a concrete class createProduct1 () // specialized createProduct2 () // specialized } AbstractFactoryIF factory = new Factory_A () factory.createProduct1 () // compose with other products factory.createProduct2 () // compose with other products
BuilderIF { // an interface or abstract class static getInstance (type) // get Concrete Builder createProduct1 () // abstract createProduct2 () // abstract } Builder_A extends BuilderIF { // a concrete class createProduct1 () // specialized createProduct2 () // specialized } BuilderIF builder = BuilderIF.getInstance (type_of_A) builder.createProduct1 () // possibly via "director" builder.createProduct2 () // possibly via "director"
Prototype { Prototype (prototypes) Product1 // to be cloned Product2 // to be cloned createProduct1 () createProduct2 () } Prototype prototype = new Prototype (prototypes) // initialize prototype.createProduct1 () prototype.createProduct2 ()
Last updated: Mon Jan 17 09:44:25 PST 2000