Package org.glassfish.hk2.utilities
Class InjecteeImpl
- java.lang.Object
-
- org.glassfish.hk2.utilities.InjecteeImpl
-
-
Field Summary
Fields Modifier and Type Field Description private ActiveDescriptor<?>injecteeDescriptorprivate booleanisOptionalprivate booleanisSelfprivate java.lang.reflect.AnnotatedElementparentprivate java.lang.Class<?>pClassprivate intpositionprivate java.util.Set<java.lang.annotation.Annotation>qualifiersprivate java.lang.reflect.TyperequiredTypeprivate Unqualifiedunqualified
-
Constructor Summary
Constructors Constructor Description InjecteeImpl()None of the fields of the returned object will be setInjecteeImpl(java.lang.reflect.Type requiredType)Only the requiredType field will be setInjecteeImpl(Injectee copyMe)This is the copy constructor, which will copy all the values from the incoming Injectee
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class<?>getInjecteeClass()Returns the parent class for this injectee.ActiveDescriptor<?>getInjecteeDescriptor()This returns the ActiveDescriptor of the injectee if it is knownjava.lang.reflect.AnnotatedElementgetParent()If this Injectee is in a constructor this will return the constructor being injected into.intgetPosition()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.TypegetRequiredType()This is the required type of the injectee.UnqualifiedgetUnqualified()This method returns theUnqualifiedannotation if it is present on the injection point.booleanisOptional()This method returns true if this injection point is annotated with VOptional.booleanisSelf()This method returns true if this injection point is annotated with VSelf.voidsetInjecteeDescriptor(ActiveDescriptor<?> injecteeDescriptor)Sets the descriptor to be associated with this injecteevoidsetOptional(boolean optional)Sets whether or not this Injectee should be considered optionalvoidsetParent(java.lang.reflect.AnnotatedElement parent)This setter sets both the parent and the injecteeClass fields.voidsetPosition(int position)Sets the position of this Injectee.voidsetRequiredQualifiers(java.util.Set<java.lang.annotation.Annotation> requiredQualifiers)Sets the required qualifiers for this InjecteevoidsetRequiredType(java.lang.reflect.Type requiredType)Sets the required type of this InjecteevoidsetSelf(boolean self)Sets whether or not this is a self-referencing injecteevoidsetUnqualified(Unqualified unqualified)Sets the unqualified annotation to be associated with this injecteejava.lang.StringtoString()
-
-
-
Field Detail
-
requiredType
private java.lang.reflect.Type requiredType
-
qualifiers
private java.util.Set<java.lang.annotation.Annotation> qualifiers
-
position
private int position
-
pClass
private java.lang.Class<?> pClass
-
parent
private java.lang.reflect.AnnotatedElement parent
-
isOptional
private boolean isOptional
-
isSelf
private boolean isSelf
-
unqualified
private Unqualified unqualified
-
injecteeDescriptor
private ActiveDescriptor<?> injecteeDescriptor
-
-
Constructor Detail
-
InjecteeImpl
public InjecteeImpl()
None of the fields of the returned object will be set
-
InjecteeImpl
public InjecteeImpl(java.lang.reflect.Type requiredType)
Only the requiredType field will be set- Parameters:
requiredType- The possibly null required type
-
InjecteeImpl
public InjecteeImpl(Injectee copyMe)
This is the copy constructor, which will copy all the values from the incoming Injectee- Parameters:
copyMe- The non-null Injectee to copy the values from
-
-
Method Detail
-
getRequiredType
public java.lang.reflect.Type getRequiredType()
Description copied from interface:InjecteeThis 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:
getRequiredTypein interfaceInjectee- 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:InjecteeThis 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:
getRequiredQualifiersin interfaceInjectee- 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
-
getPosition
public int getPosition()
Description copied from interface:InjecteeIf 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:
getPositionin interfaceInjectee- 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 descrbing a field
-
getInjecteeClass
public java.lang.Class<?> getInjecteeClass()
Description copied from interface:InjecteeReturns 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:
getInjecteeClassin interfaceInjectee- Returns:
- The class of the object that will be injected into
-
getParent
public java.lang.reflect.AnnotatedElement getParent()
Description copied from interface:InjecteeIf 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
-
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:InjecteeThis 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:
isOptionalin interfaceInjectee- 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
-
isSelf
public boolean isSelf()
Description copied from interface:InjecteeThis method returns true if this injection point is annotated with VSelf. In this case the required type must have a raw class ofActiveDescriptor, isOptional must be false and the set of required qualifiers must be empty
-
setSelf
public void setSelf(boolean self)
Sets whether or not this is a self-referencing injectee- Parameters:
self- true if this is a self-referencing Injectee, and false otherwise
-
getUnqualified
public Unqualified getUnqualified()
Description copied from interface:InjecteeThis method returns theUnqualifiedannotation if it is present on the injection point. This can be used to determine what qualifiers should NOT be given to the injection point.- Specified by:
getUnqualifiedin interfaceInjectee- Returns:
- The
Unqualifiedannotation on the injection point, or null if there is noUnqualifiedannotation on the injection point
-
setUnqualified
public void setUnqualified(Unqualified unqualified)
Sets the unqualified annotation to be associated with this injectee- Parameters:
unqualified- The unqualified annotation to be associated with this injectee
-
getInjecteeDescriptor
public ActiveDescriptor<?> getInjecteeDescriptor()
Description copied from interface:InjecteeThis returns the ActiveDescriptor of the injectee if it is known- Specified by:
getInjecteeDescriptorin interfaceInjectee- Returns:
- The ActiveDescriptor of the injectee, or null if the parent is not known
-
setInjecteeDescriptor
public void setInjecteeDescriptor(ActiveDescriptor<?> injecteeDescriptor)
Sets the descriptor to be associated with this injectee- Parameters:
injecteeDescriptor- The injectee to be associated with this injectee
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-