Package cdc.args
Class AbstractFactory<T>
- java.lang.Object
-
- cdc.args.AbstractFactory<T>
-
- Type Parameters:
T- Type of created objects.
- All Implemented Interfaces:
Factory<T>
- Direct Known Subclasses:
AutoFactory
public abstract class AbstractFactory<T> extends Object implements Factory<T>
Base class for factory implementation.- Author:
- Damien Carbonne
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractFactory(Class<T> objectClass)Creates a factory that does not accept any argument for creation.protectedAbstractFactory(Class<T> objectClass, Args meta)Creates a factory that does not accept any argument for creation.protectedAbstractFactory(Class<T> objectClass, Args meta, FormalArgs... creationFormalArgs)Creates a factory with an array of possible tuples for creation.protectedAbstractFactory(Class<T> objectClass, Args meta, List<FormalArgs> creationFormalArgs)Creates a factory with a list of possible tuples for creation.protectedAbstractFactory(Class<T> objectClass, FormalArgs... creationFormalArgs)protectedAbstractFactory(Class<T> objectClass, List<FormalArgs> creationFormalArgs)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Tcreate(Args args)Creates aTinstance.protected abstract Tcreate(Args args, FormalArgs fargs)Creates an object.List<FormalArgs>getCreationFormalArgsList()Returns a list of supported creation arguments.ArgsgetMeta()Class<T>getObjectClass()StringtoString()
-
-
-
Constructor Detail
-
AbstractFactory
protected AbstractFactory(Class<T> objectClass, Args meta, List<FormalArgs> creationFormalArgs)
Creates a factory with a list of possible tuples for creation.- Parameters:
objectClass- The class of created objects.meta- The meta parameters associated to this factory.creationFormalArgs- A list of tuples of formal arguments that can be used for creation.
-
AbstractFactory
protected AbstractFactory(Class<T> objectClass, List<FormalArgs> creationFormalArgs)
-
AbstractFactory
protected AbstractFactory(Class<T> objectClass, Args meta, FormalArgs... creationFormalArgs)
Creates a factory with an array of possible tuples for creation.- Parameters:
objectClass- The class of created objects.meta- The meta parameters associated to this factory.creationFormalArgs- An array of tuples of formal arguments that can be used for creation.
-
AbstractFactory
protected AbstractFactory(Class<T> objectClass, FormalArgs... creationFormalArgs)
-
AbstractFactory
protected AbstractFactory(Class<T> objectClass, Args meta)
Creates a factory that does not accept any argument for creation.- Parameters:
meta- The meta parameters associated to this factory.objectClass- The class of created objects.
-
-
Method Detail
-
getObjectClass
public final Class<T> getObjectClass()
- Specified by:
getObjectClassin interfaceFactory<T>- Returns:
- The class of built objects.
-
getMeta
public final Args getMeta()
-
getCreationFormalArgsList
public final List<FormalArgs> getCreationFormalArgsList()
Description copied from interface:FactoryReturns a list of supported creation arguments.This list must not be empty.
If creation does not need any arguments, a list containing FormalArgs.NO_FARGS should be returned.- Specified by:
getCreationFormalArgsListin interfaceFactory<T>- Returns:
- A list of supported creation arguments.
-
create
protected abstract T create(Args args, FormalArgs fargs)
Creates an object.This is the creation method that must be implemented.
- Parameters:
args- The effective arguments.fargs- The formal arguments that match the effective ones.- Returns:
- The create object.
-
create
public final T create(Args args)
Description copied from interface:FactoryCreates aTinstance.
-
-