Class InjecteeImpl

  • All Implemented Interfaces:
    Injectee

    public class InjecteeImpl
    extends java.lang.Object
    implements Injectee
    An Injectee represents the point of injection. It can be used by injection resolvers to discover all of the information available about the entity being injected into.
    • Constructor Summary

      Constructors 
      Constructor Description
      InjecteeImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.Class<?> getInjecteeClass()
      Returns the parent class for this injectee.
      ForeignDescriptor getInjecteeDescriptor()
      This method returns foreign descriptor of the current injectee that means that the DI provider is able to store its specific descriptor and that use it in the descriptor processing.
      java.lang.reflect.AnnotatedElement getParent()
      If this Injectee is in a constructor this will return the constructor being injected into.
      java.lang.Class<? extends java.lang.annotation.Annotation> getParentClassScope()
      This method returns scope in which the parent class is registered.
      int getPosition()
      If this Injectee is a constructor or method parameter, this will return the index of the parameter.
      java.util.Set<java.lang.annotation.Annotation> getRequiredQualifiers()
      This is the set of required qualifiers for this injectee.
      java.lang.reflect.Type getRequiredType()
      This is the required type of the injectee.
      int hashCode()  
      boolean isFactory()
      This method returns true if the injectee value is provided using Supplier.
      boolean isOptional()
      This method returns true if this injection point is annotated with VOptional.
      boolean isProvider()
      This method returns true if the injectee value is provided using Provider.
      void setFactory​(boolean factory)
      Sets a flag whether the injectee is a factory.
      void setInjecteeClass​(java.lang.Class<?> injecteeClass)
      Sets type of the injectee.
      void setInjecteeDescriptor​(ForeignDescriptor injecteeDescriptor)
      Sets the descriptor for this Injectee.
      void setOptional​(boolean optional)
      Sets whether or not this Injectee should be considered optional.
      void setParent​(java.lang.reflect.AnnotatedElement parent)
      This setter sets both the parent and the injecteeClass fields.
      void setParentClassScope​(java.lang.Class<? extends java.lang.annotation.Annotation> parentClassScope)
      Sets the scope in which the parent class is registered.
      void setPosition​(int position)
      Sets the position of this Injectee.
      void setProvider​(boolean provider)
      Sets a flag whether the injectee is a provider.
      void setRequiredQualifiers​(java.util.Set<java.lang.annotation.Annotation> requiredQualifiers)
      Sets the required qualifiers for this Injectee.
      void setRequiredType​(java.lang.reflect.Type requiredType)
      Sets the required type of this Injectee.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • requiredType

        private java.lang.reflect.Type requiredType
      • qualifiers

        private java.util.Set<java.lang.annotation.Annotation> qualifiers
      • parentClassScope

        private java.lang.Class<? extends java.lang.annotation.Annotation> parentClassScope
      • position

        private int position
      • injecteeClass

        private java.lang.Class<?> injecteeClass
      • parent

        private java.lang.reflect.AnnotatedElement parent
      • isOptional

        private boolean isOptional
      • isFactory

        private boolean isFactory
      • isProvider

        private boolean isProvider
    • Constructor Detail

      • InjecteeImpl

        public InjecteeImpl()
    • Method Detail

      • getRequiredType

        public java.lang.reflect.Type getRequiredType()
        Description copied from interface: Injectee
        This is the required type of the injectee. The object that is injected into this point must be type-safe with regards to this type.
        Specified by:
        getRequiredType in interface Injectee
        Returns:
        The type that this injectee is expecting. Any object injected into this injection point must be type-safe with regards to this type.
      • setRequiredType

        public void setRequiredType​(java.lang.reflect.Type requiredType)
        Sets the required type of this Injectee.
        Parameters:
        requiredType - The required type of this injectee.
      • getRequiredQualifiers

        public java.util.Set<java.lang.annotation.Annotation> getRequiredQualifiers()
        Description copied from interface: Injectee
        This is the set of required qualifiers for this injectee. All of these qualifiers must be present on the implementation class of the object that is injected into this injectee. Note that the fields of the annotation must also match.
        Specified by:
        getRequiredQualifiers in interface Injectee
        Returns:
        Will not return null, but may return an empty set. The set of all qualifiers that must match.
      • setRequiredQualifiers

        public void setRequiredQualifiers​(java.util.Set<java.lang.annotation.Annotation> requiredQualifiers)
        Sets the required qualifiers for this Injectee.
        Parameters:
        requiredQualifiers - The non-null set of required qualifiers.
      • getParentClassScope

        public java.lang.Class<? extends java.lang.annotation.Annotation> getParentClassScope()
        Description copied from interface: Injectee
        This method returns scope in which the parent class is registered.
        Specified by:
        getParentClassScope in interface Injectee
        Returns:
        scope annotation.
      • setParentClassScope

        public void setParentClassScope​(java.lang.Class<? extends java.lang.annotation.Annotation> parentClassScope)
        Sets the scope in which the parent class is registered.
      • isFactory

        public boolean isFactory()
        Description copied from interface: Injectee
        This method returns true if the injectee value is provided using Supplier.
        Specified by:
        isFactory in interface Injectee
        Returns:
        true if the injectee is a factory.
      • setFactory

        public void setFactory​(boolean factory)
        Sets a flag whether the injectee is a factory.
        Parameters:
        factory - true flag whether the injectee is factory.
      • isProvider

        public boolean isProvider()
        Description copied from interface: Injectee
        This method returns true if the injectee value is provided using Provider.
        Specified by:
        isProvider in interface Injectee
        Returns:
        true if the injectee is a provider.
      • setProvider

        public void setProvider​(boolean provider)
        Sets a flag whether the injectee is a provider.
        Parameters:
        provider - true flag whether the injectee is provider.
      • getPosition

        public int getPosition()
        Description copied from interface: Injectee
        If this Injectee is a constructor or method parameter, this will return the index of the parameter. If this Injectee is a field, this will return -1.
        Specified by:
        getPosition in interface Injectee
        Returns:
        the position of the parameter, or -1 if this is a field.
      • setPosition

        public void setPosition​(int position)
        Sets the position of this Injectee. The position represents the index of the parameter, or -1 if this Injectee is describing a field.
        Parameters:
        position - The index position of the parameter, or -1 if describing a field.
      • getInjecteeClass

        public java.lang.Class<?> getInjecteeClass()
        Description copied from interface: Injectee
        Returns the parent class for this injectee. This is the class of the object that will be injected into. This field may return null if this is from a service lookup.
        Specified by:
        getInjecteeClass in interface Injectee
        Returns:
        The class of the object that will be injected into.
      • setInjecteeClass

        public void setInjecteeClass​(java.lang.Class<?> injecteeClass)
        Sets type of the injectee.
        Parameters:
        injecteeClass - injectee type.
      • getParent

        public java.lang.reflect.AnnotatedElement getParent()
        Description copied from interface: Injectee
        If this Injectee is in a constructor this will return the constructor being injected into. If this Injectee is in a method this will return the method being injected into. If this injectee represents a field, this will return the field being injected into. This injectee may be neither in which case this will return null.
        Specified by:
        getParent in interface Injectee
        Returns:
        The parent of the injectee, which may be null.
      • setParent

        public void setParent​(java.lang.reflect.AnnotatedElement parent)
        This setter sets both the parent and the injecteeClass fields.
        Parameters:
        parent - The parent (Field, Constructor or Method) which is the parent of this Injectee.
      • isOptional

        public boolean isOptional()
        Description copied from interface: Injectee
        This method returns true if this injection point is annotated with VOptional. In this case if there is no definition for the injection point in the system it is allowable for the system to merely return null.
        Specified by:
        isOptional in interface Injectee
        Returns:
        true if the injection point is annotated with VOptional, false otherwise.
      • setOptional

        public void setOptional​(boolean optional)
        Sets whether or not this Injectee should be considered optional.
        Parameters:
        optional - true if this injectee is optional, false if required.
      • getInjecteeDescriptor

        public ForeignDescriptor getInjecteeDescriptor()
        Description copied from interface: Injectee
        This method returns foreign descriptor of the current injectee that means that the DI provider is able to store its specific descriptor and that use it in the descriptor processing.
        Specified by:
        getInjecteeDescriptor in interface Injectee
        Returns:
        DI specific foreign descriptor.
      • setInjecteeDescriptor

        public void setInjecteeDescriptor​(ForeignDescriptor injecteeDescriptor)
        Sets the descriptor for this Injectee.
        Parameters:
        injecteeDescriptor - injectee's descriptor.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object