com.sun.hk2.jsr330.spi.internal
Class Jsr330InjectionResolver
java.lang.Object
com.sun.hk2.component.InjectionResolver<Inject>
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
|
Method Summary |
protected static
|
get(Habitat habitat,
Object onBehalfOf,
AnnotatedElement target,
Class<V> type)
|
protected static
|
getComponentInjectValue(Habitat habitat,
Class<V> type)
|
protected Type |
getGenericType(Type gtype,
AnnotatedElement target)
|
protected static
|
getHolderInjectValue(Habitat habitat,
Object onBehalfOf,
AnnotatedElement target,
Type paramType)
|
protected static
|
getInhabitant(Habitat habitat,
Object onBehalfOf,
Class<V> type)
|
protected static
|
getInhabitant(Habitat habitat,
Object onBehalfOf,
Class<V> type,
String name)
|
protected static
|
getServiceInjectValue(Habitat habitat,
Class<V> type,
Annotation[] annotations)
|
protected static
|
getServiceInjectValue(Habitat habitat,
Class<V> type,
String name)
|
|
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Jsr330InjectionResolver
public Jsr330InjectionResolver()
Jsr330InjectionResolver
public Jsr330InjectionResolver(Habitat h)
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 instanceonBehalfOf - inhabitant doing the injection fortarget - is the annotated java element Method
or Fieldgtype - 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.
getGenericType
protected Type getGenericType(Type gtype,
AnnotatedElement target)
getHolderInjectValue
protected static <V> Provider<V> getHolderInjectValue(Habitat habitat,
Object onBehalfOf,
AnnotatedElement target,
Type paramType)
throws ComponentException
- Throws:
ComponentException
getInhabitant
protected static <V> Inhabitant<V> getInhabitant(Habitat habitat,
Object onBehalfOf,
Class<V> type)
getInhabitant
protected static <V> Inhabitant<V> getInhabitant(Habitat habitat,
Object onBehalfOf,
Class<V> type,
String name)
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 Fieldannotation - the injection metadata
- Returns:
- true if the
getValue() can return null without generating a
faulty injection operation
Copyright © 2012 Oracle Corporation. All Rights Reserved.