Class AbstractFactory<T,C extends IConstructor<T>>

java.lang.Object
fr.phylisiumstudio.logic.fabric.AbstractFactory<T,C>
Type Parameters:
T - the type of object to create
C - the type of constructor
Direct Known Subclasses:
ShapeAbstractFabric

public abstract class AbstractFactory<T,C extends IConstructor<T>> extends Object
Abstract factory for creating objects
  • Constructor Details

    • AbstractFactory

      public AbstractFactory()
      Create a new abstract factory
  • Method Details

    • construct

      public T construct(String name, Object... args)
      Construct an object by name
      Parameters:
      name - the name of the object to construct
      Returns:
      the object
    • getAllRegisteredNames

      public List<String> getAllRegisteredNames()
      Get all the registered names
      Returns:
      the names
    • registerConstructor

      public void registerConstructor(C constructor)
      Register a constructor
      Parameters:
      constructor - the constructor
    • unregisterConstructor

      public void unregisterConstructor(C constructor)
      Unregister a constructor
      Parameters:
      constructor - the constructor
    • getConstructor

      public C getConstructor(String name)
      Get the constructor by name
      Parameters:
      name - the name
      Returns:
      the constructor
    • getConstructors

      public List<C> getConstructors()
      Get all the constructors
      Returns:
      the constructors in a new list
    • clear

      public void clear()
      Clear all the constructors