Class ClassObjectFactory<T>
- java.lang.Object
-
- org.int4.dirk.core.definition.factory.ClassObjectFactory<T>
-
- Type Parameters:
T- the type of the instances produced
- All Implemented Interfaces:
Constructable<T>
public class ClassObjectFactory<T> extends java.lang.Object implements Constructable<T>
Object factory for concrete classes. This factory use the givenConstructorto construct the associated class, inject it using the givenInjections and do life cycle callbacks using the providedLifeCycleCallbacksinstance.
-
-
Constructor Summary
Constructors Constructor Description ClassObjectFactory(java.lang.reflect.Constructor<T> constructor, LifeCycleCallbacks lifeCycleCallbacks)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tcreate(java.util.List<Injection> injections)Creates an instance.voiddestroy(T instance)Destroys an instance.
-
-
-
Constructor Detail
-
ClassObjectFactory
public ClassObjectFactory(java.lang.reflect.Constructor<T> constructor, LifeCycleCallbacks lifeCycleCallbacks)
Constructs a new instance.- Parameters:
constructor- aConstructorwhich produces the required class, cannot benulllifeCycleCallbacks- aLifeCycleCallbacksinstance, cannot benull
-
-
Method Detail
-
create
public T create(java.util.List<Injection> injections) throws org.int4.dirk.api.instantiation.CreationException
Description copied from interface:ConstructableCreates an instance.- Specified by:
createin interfaceConstructable<T>- Parameters:
injections- a list ofInjectioncontaining values to be injected, nevernullor containsnulls but can be empty- Returns:
- an instance, or
nullif it could not be provided - Throws:
org.int4.dirk.api.instantiation.CreationException- when instantiation fails
-
destroy
public void destroy(T instance)
Description copied from interface:ConstructableDestroys an instance.- Specified by:
destroyin interfaceConstructable<T>- Parameters:
instance- an instance to destroy, cannot benull
-
-