The Factory Pattern in InfoGrid
InfoGrid uses the factory pattern extensively throughout the code base.
- Many classes have protected constructors and offer public, static factory methods called create, or a variation, instead
- The abstract Factory interface in package org.infogrid.util is used wherever appropriate.
Two subtypes of Factory are notable:
- SmartFactory is implemented by those classes that act as Factory for some objects, but keep a record of already-created objects and return those instead of newly created objects under some circumstances (that depend on the particular `Factory).
- PatientSmartFactory optimizes the SmartFactory algorithm for those objects whose creation may take a long time, while the SmartFactory may be invoked concurrently by several threads.