org.glassfish.hk2.api
Interface Injectee

All Known Implementing Classes:
InjecteeImpl

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

Author:
jwells

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

Method Detail

getRequiredType

Type getRequiredType()
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

Returns:
The type that this injectee is expecting. Any object injected into this injection point must be type-safe with regards to this type

getRequiredQualifiers

Set<Annotation> getRequiredQualifiers()
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

Returns:
Will not return null, but may return an empty set. The set of all qualifiers that must match.

getPosition

int getPosition()
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

Returns:
the position of the parameter, or -1 if this is a field

getInjecteeClass

Class<?> getInjecteeClass()
Returns the parent class for this injectee. This is the class of the object that will be injected into.

Returns:
The class of the object that will be injected into

getParent

AnnotatedElement getParent()
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

Returns:
The parent of the injectee

isOptional

boolean isOptional()
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

Returns:
true if the injection point is annotated with VOptional, false otherwise

isSelf

boolean isSelf()
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

Returns:
true if the injection point is annotated with VSelf, false otherwise


Copyright © 2013 Oracle Corporation. All Rights Reserved.