org.perfectjpattern.core.api.creational.factorymethod
Interface IFactoryMethod<T>

Type Parameters:
T - Type of elements created.

public interface IFactoryMethod<T>

Factory Method Design Pattern: Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. (Gamma et al, Design Patterns)

Responsibility Abstract definition of the "Creator":


Example usage:

 import org.perfectjpattern.core.api.creational.factorymethod.*;
       
  //
  // Example of Factory Method subtype that creates Product with a
  // name parameter. 
  //
  public IProductFactory
  extends IFactoryMethod<Product>
  {
      //--------------------------------------------------------------------
      // public
      //--------------------------------------------------------------------
      public void
      setName(String aName);          
  } 
 
 

Version:
$Revision: 1.0 $ $Date: Jun 19, 2007 11:01:51 PM $
Author:
Giovanni Azua
 

Method Summary
 T create()
          Returns newly created instance
 

Method Detail

create

T create()
Returns newly created instance

Returns:
Newly created instance


Copyright © 2007-2009. All Rights Reserved.