Package org.int4.dirk.spi.instantiation
Class InjectionTargetExtension<T,E>
- java.lang.Object
-
- org.int4.dirk.spi.instantiation.InjectionTargetExtension<T,E>
-
- Type Parameters:
T- the type handledE- the element type required
public class InjectionTargetExtension<T,E> extends java.lang.ObjectAn interface to allow for custom handling of injection targets of typeT. The target class must be an interface with at least one type variable.Whenever an injection target of type
Tneeds injection this extension will be called to provide the actual value.
-
-
Constructor Summary
Constructors Constructor Description InjectionTargetExtension(java.lang.reflect.TypeVariable<java.lang.Class<T>> elementTypeVariable, Resolution resolution, InstanceProvider<T,E> instanceProvider)Constructs a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.reflect.TypeVariable<java.lang.Class<T>>getElementTypeVariable()Returns aTypeVariablewhich represents the element typeE.InstanceProvider<T,E>getInstanceProvider()Returns theInstanceProviderthat can create the type handled by this extension.ResolutiongetResolution()Returns how the injection target should be resolved.java.lang.Class<T>getTargetClass()Returns the target class that is handled by this extension.
-
-
-
Constructor Detail
-
InjectionTargetExtension
public InjectionTargetExtension(java.lang.reflect.TypeVariable<java.lang.Class<T>> elementTypeVariable, Resolution resolution, InstanceProvider<T,E> instanceProvider)
Constructs a new instance.- Parameters:
elementTypeVariable- aTypeVariablewhich represents the element typeE, cannot benullresolution- aResolution, cannot benullinstanceProvider- anInstanceProvider, cannot benull
-
-
Method Detail
-
getTargetClass
public final java.lang.Class<T> getTargetClass()
Returns the target class that is handled by this extension.- Returns:
- a
Class, nevernull
-
getInstanceProvider
public final InstanceProvider<T,E> getInstanceProvider()
Returns theInstanceProviderthat can create the type handled by this extension.- Returns:
- an
InstanceProvider, nevernull
-
getElementTypeVariable
public final java.lang.reflect.TypeVariable<java.lang.Class<T>> getElementTypeVariable()
Returns aTypeVariablewhich represents the element typeE.- Returns:
- a
TypeVariable, nevernull
-
getResolution
public final Resolution getResolution()
Returns how the injection target should be resolved. This determines what kind of restrictions are applied when an injection target of this type is added to an injector. When eager, restrictions are enforced before the injector is modified. When lazy, use of theInstancemay result in errors if the required types are not available.- Returns:
- a
Resolution, nevernull
-
-