Class InjectionTargetExtension<T,​E>

  • Type Parameters:
    T - the type handled
    E - the element type required

    public class InjectionTargetExtension<T,​E>
    extends java.lang.Object
    An interface to allow for custom handling of injection targets of type T. The target class must be an interface with at least one type variable.

    Whenever an injection target of type T needs injection this extension will be called to provide the actual value.

    • 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 - a TypeVariable which represents the element type E, cannot be null
        resolution - a Resolution, cannot be null
        instanceProvider - an InstanceProvider, cannot be null
    • Method Detail

      • getTargetClass

        public final java.lang.Class<T> getTargetClass()
        Returns the target class that is handled by this extension.
        Returns:
        a Class, never null
      • getElementTypeVariable

        public final java.lang.reflect.TypeVariable<java.lang.Class<T>> getElementTypeVariable()
        Returns a TypeVariable which represents the element type E.
        Returns:
        a TypeVariable, never null
      • 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 the Instance may result in errors if the required types are not available.
        Returns:
        a Resolution, never null