com.sun.hk2.component
Class InjectInjectionResolver
java.lang.Object
com.sun.hk2.component.InjectionResolver<Inject>
com.sun.hk2.component.InjectInjectionResolver
public class InjectInjectionResolver
- extends InjectionResolver<Inject>
InjectInjectionResolver, handles all Inject annotations
Method Summary |
protected
|
getArrayInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type)
|
protected
|
getComponentInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type,
Inject inject)
|
protected
|
getHolderInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type,
Inject inject)
|
protected
|
getServiceInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type,
Inject inject)
|
|
getValue(java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type)
Obtains the value to inject, based on the type and Inject annotation. |
boolean |
isOptional(java.lang.reflect.AnnotatedElement element,
Inject annotation)
Returns true if the resolution of this injection identified by the
passed annotation instance is optional |
protected
|
validate(java.lang.Object component,
V toBeInjected)
Verifies the injection does not violate any integrity rules. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InjectInjectionResolver
public InjectInjectionResolver(Habitat habitat)
isOptional
public boolean isOptional(java.lang.reflect.AnnotatedElement element,
Inject annotation)
- Description copied from class:
InjectionResolver
- Returns true if the resolution of this injection identified by the
passed annotation instance is optional
- Overrides:
isOptional
in class InjectionResolver<Inject>
- Parameters:
element
- is the annotated java element Method
or Field
annotation
- the injection metadata
- Returns:
- true if the
getValue()
can return null without generating a
faulty injection operation
getValue
public <V> V getValue(java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type)
throws ComponentException
- Obtains the value to inject, based on the type and
Inject
annotation.
- Specified by:
getValue
in class InjectionResolver<Inject>
- Parameters:
component
- injection target instanceonBehalfOf
- inhabitant doing the injection fortarget
- is the annotated java element Method
or Field
genericType
- the generic type of the expected returntype
- type of the expected return
- Returns:
- the resource to be injected
- Throws:
ComponentException
- if the resource cannot be located.
getArrayInjectValue
protected <V> V getArrayInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type)
getHolderInjectValue
protected <V> V getHolderInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type,
Inject inject)
throws ComponentException
- Throws:
ComponentException
getServiceInjectValue
protected <V> V getServiceInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type,
Inject inject)
throws ComponentException
- Throws:
ComponentException
getComponentInjectValue
protected <V> V getComponentInjectValue(Habitat habitat,
java.lang.Object component,
Inhabitant<?> onBehalfOf,
java.lang.reflect.AnnotatedElement target,
java.lang.reflect.Type genericType,
java.lang.Class<V> type,
Inject inject)
throws ComponentException
- Throws:
ComponentException
validate
protected <V> V validate(java.lang.Object component,
V toBeInjected)
- Verifies the injection does not violate any integrity rules.
- Parameters:
component
- the target component to be injectedtoBeInjected
- the injected value
Copyright © 2010 Oracle Corporation. All Rights Reserved.