com.sun.hk2.component
Class InjectInjectionResolver

java.lang.Object
  extended by com.sun.hk2.component.InjectionResolver<Inject>
      extended by com.sun.hk2.component.InjectInjectionResolver

public class InjectInjectionResolver
extends InjectionResolver<Inject>

InjectInjectionResolver, handles all Inject annotations


Field Summary
 
Fields inherited from class com.sun.hk2.component.InjectionResolver
type
 
Constructor Summary
InjectInjectionResolver(Habitat habitat)
           
 
Method Summary
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)
           
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)
           
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)
           
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)
           
<V> V
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
<V> V
validate(java.lang.Object component, V toBeInjected)
          Verifies the injection does not violate any integrity rules.
 
Methods inherited from class com.sun.hk2.component.InjectionResolver
getSetterMethod
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InjectInjectionResolver

public InjectInjectionResolver(Habitat habitat)
Method Detail

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 instance
onBehalfOf - inhabitant doing the injection for
target - is the annotated java element Method or Field
genericType - the generic type of the expected return
type - 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 injected
toBeInjected - the injected value


Copyright © 2010 Oracle Corporation. All Rights Reserved.