org.glassfish.hk2.utilities
Class InjecteeImpl

java.lang.Object
  extended by org.glassfish.hk2.utilities.InjecteeImpl
All Implemented Interfaces:
Serializable, Injectee

public class InjecteeImpl
extends Object
implements Injectee, Serializable

This is a writeable version of the Injectee interface. Using this implementation may make your code more portable, as new methods added to the interface will be reflected in this class.

Author:
jwells
See Also:
Serialized Form

Constructor Summary
InjecteeImpl()
          None of the fields of the returned object will be set
InjecteeImpl(Injectee copyMe)
          This is the copy constructor, which will copy all the values from the incoming Injectee
 
Method Summary
 Class<?> getInjecteeClass()
          Returns the parent class for this injectee.
 AnnotatedElement getParent()
          If this Injectee is in a constructor this will return the constructor being injected into.
 int getPosition()
          If this Injectee is a constructor or method parameter, this will return the index of the parameter.
 Set<Annotation> getRequiredQualifiers()
          This is the set of required qualifiers for this injectee.
 Type getRequiredType()
          This is the required type of the injectee.
 Unqualified getUnqualified()
          This method returns the Unqualified annotation if it is present on the injection point.
 boolean isOptional()
          This method returns true if this injection point is annotated with VOptional.
 boolean isSelf()
          This method returns true if this injection point is annotated with VSelf.
 void setOptional(boolean optional)
          Sets whether or not this Injectee should be considered optional
 void setParent(AnnotatedElement parent)
          This setter sets both the parent and the injecteeClass fields.
 void setPosition(int position)
          Sets the position of this Injectee.
 void setRequiredQualifiers(Set<Annotation> requiredQualifiers)
          Sets the required qualifiers for this Injectee
 void setRequiredType(Type requiredType)
          Sets the required type of this Injectee
 void setSelf(boolean self)
          Sets whether or not this is a self-referencing injectee
 void setUnqualified(Unqualified unqualified)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

InjecteeImpl

public InjecteeImpl()
None of the fields of the returned object will be set


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 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(Type requiredType)
Sets the required type of this Injectee

Parameters:
requiredType - The required type of this injectee

getRequiredQualifiers

public Set<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(Set<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: 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 descrbing a field

getInjecteeClass

public 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.

Specified by:
getInjecteeClass in interface Injectee
Returns:
The class of the object that will be injected into

getParent

public 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

Specified by:
getParent in interface Injectee
Returns:
The parent of the injectee

setParent

public void setParent(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

isSelf

public boolean isSelf()
Description copied from interface: Injectee
This method returns true if this injection point is annotated with VSelf. In this case the required type must have a raw class of ActiveDescriptor, isOptional must be false and the set of required qualifiers must be empty

Specified by:
isSelf in interface Injectee
Returns:
true if the injection point is annotated with VSelf, false otherwise

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: Injectee
This method returns the Unqualified annotation 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:
getUnqualified in interface Injectee
Returns:
The Unqualified annotation on the injection point, or null if there is no Unqualified annotation on the injection point

setUnqualified

public void setUnqualified(Unqualified unqualified)

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 Oracle Corporation. All Rights Reserved.