com.sun.hk2.jsr330.spi.internal
Class Jsr330InjectionResolver

java.lang.Object
  extended by com.sun.hk2.component.InjectionResolver<Inject>
      extended by com.sun.hk2.jsr330.spi.internal.Jsr330InjectionResolver
All Implemented Interfaces:
InjectionResolverQuery

public class Jsr330InjectionResolver
extends InjectionResolver<Inject>

Jsr-330 Injection Resolver

Since:
3.1
Author:
Jeff Trent

Field Summary
 
Fields inherited from class com.sun.hk2.component.InjectionResolver
type
 
Constructor Summary
Jsr330InjectionResolver()
           
Jsr330InjectionResolver(Habitat h)
           
 
Method Summary
protected static
<V> V
get(Habitat habitat, Object onBehalfOf, AnnotatedElement target, Class<V> type)
           
protected static
<V> V
getComponentInjectValue(Habitat habitat, Class<V> type)
           
protected  Type getGenericType(Type gtype, AnnotatedElement target)
           
protected static
<V> Provider<V>
getHolderInjectValue(Habitat habitat, Object onBehalfOf, Type paramType)
           
protected static
<V> Inhabitant<V>
getInhabitant(Habitat habitat, Object onBehalfOf, Class<V> type)
           
protected static
<V> V
getServiceInjectValue(Habitat habitat, Class<V> type, Annotation[] annotations)
           
protected static
<V> V
getServiceInjectValue(Habitat habitat, Class<V> type, String name)
           
<V> V
getValue(Object component, Inhabitant<?> onBehalfOf, AnnotatedElement target, Type gtype, Class<V> type)
          Returns the value to inject in the field or method of component annotated with the annotated annotation.
 boolean isOptional(AnnotatedElement annotated, Inject annotation)
          Returns true if the resolution of this injection identified by the passed annotation instance is optional
protected static boolean matched(Annotation[] annotations, MultiMap<String,String> candidateMd)
           
 
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

Jsr330InjectionResolver

public Jsr330InjectionResolver()

Jsr330InjectionResolver

public Jsr330InjectionResolver(Habitat h)
Method Detail

getValue

public <V> V getValue(Object component,
                      Inhabitant<?> onBehalfOf,
                      AnnotatedElement target,
                      Type gtype,
                      Class<V> type)
           throws ComponentException
Description copied from interface: InjectionResolverQuery
Returns the value to inject in the field or method of component annotated with the annotated annotation.

Parameters:
component - injection target instance
onBehalfOf - inhabitant doing the injection for
target - is the annotated java element Method or Field
gtype - 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.

getGenericType

protected Type getGenericType(Type gtype,
                              AnnotatedElement target)

getHolderInjectValue

protected static <V> Provider<V> getHolderInjectValue(Habitat habitat,
                                                      Object onBehalfOf,
                                                      Type paramType)
                                           throws ComponentException
Throws:
ComponentException

getInhabitant

protected static <V> Inhabitant<V> getInhabitant(Habitat habitat,
                                                 Object onBehalfOf,
                                                 Class<V> type)

get

protected static <V> V get(Habitat habitat,
                           Object onBehalfOf,
                           AnnotatedElement target,
                           Class<V> type)

getServiceInjectValue

protected static <V> V getServiceInjectValue(Habitat habitat,
                                             Class<V> type,
                                             String name)
                                  throws ComponentException
Throws:
ComponentException

getServiceInjectValue

protected static <V> V getServiceInjectValue(Habitat habitat,
                                             Class<V> type,
                                             Annotation[] annotations)
                                  throws ComponentException
Throws:
ComponentException

matched

protected static boolean matched(Annotation[] annotations,
                                 MultiMap<String,String> candidateMd)

getComponentInjectValue

protected static <V> V getComponentInjectValue(Habitat habitat,
                                               Class<V> type)
                                    throws ComponentException
Throws:
ComponentException

isOptional

public boolean isOptional(AnnotatedElement annotated,
                          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:
annotated - 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


Copyright © 2012 Oracle Corporation. All Rights Reserved.