Package fr.phylisiumstudio.logic.fabric
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 createC
- the type of constructor
- Direct Known Subclasses:
ShapeAbstractFabric
Abstract factory for creating objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear all the constructorsConstruct an object by nameGet all the registered namesgetConstructor
(String name) Get the constructor by nameGet all the constructorsvoid
registerConstructor
(C constructor) Register a constructorvoid
unregisterConstructor
(C constructor) Unregister a constructor
-
Constructor Details
-
AbstractFactory
public AbstractFactory()Create a new abstract factory
-
-
Method Details
-
construct
Construct an object by name- Parameters:
name
- the name of the object to construct- Returns:
- the object
-
getAllRegisteredNames
Get all the registered names- Returns:
- the names
-
registerConstructor
Register a constructor- Parameters:
constructor
- the constructor
-
unregisterConstructor
Unregister a constructor- Parameters:
constructor
- the constructor
-
getConstructor
Get the constructor by name- Parameters:
name
- the name- Returns:
- the constructor
-
getConstructors
Get all the constructors- Returns:
- the constructors in a new list
-
clear
public void clear()Clear all the constructors
-