Static Factory

A Static Factory is a static procedure that creates an object, often an AbstractFactory.

public abstract class AbstractFactory {
  public static AbstractFactory createAnAbstractFactory() {
// load a specific AbstractFactory somehow...
// like dynamically from a configuration file
  }
  public abstract ConcreteProduce1 createConcreteProduce1();
  public abstract ConcreteProduce2 createConcreteProduce2();
  public abstract ConcreteProduce3 createConcreteProduce3();
}
The above example is an AbstractFactory that has a StaticFactory built into it. You create your instance by configing it in some way (like a config file or global property name) and calling it like so:

AbstractFactory fact = AbstractFactory.createAnAbstractFactory();
Easy as cake.


EditText of this page (last edited September 19, 2005) or FindPage with title or text search