com.sun.hk2.component
Class InjectionResolver<U extends java.lang.annotation.Annotation>

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

public abstract class InjectionResolver<U extends java.lang.annotation.Annotation>
extends java.lang.Object

Implementation of this abstract class are handling injection resolution for a particular injection annotation Inject

Author:
Jerome Dochez

Field Summary
 java.lang.Class<U> type
           
 
Constructor Summary
InjectionResolver(java.lang.Class<U> type)
          Construct a resolver with a particular injection type
 
Method Summary
abstract  java.lang.Object getValue(java.lang.Object component, java.lang.reflect.AnnotatedElement annotated, java.lang.Class type)
          Returns the value to inject in the field or method of component annotated with the annotated annotation.
 boolean isOptional(U annotation)
          Returns true if the resolution of this injection identified by the passed annotation instance is optional
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public final java.lang.Class<U extends java.lang.annotation.Annotation> type
Constructor Detail

InjectionResolver

public InjectionResolver(java.lang.Class<U> type)
Construct a resolver with a particular injection type

Parameters:
type - the injection annotation type
Method Detail

isOptional

public boolean isOptional(U annotation)
Returns true if the resolution of this injection identified by the passed annotation instance is optional

Parameters:
annotation - the injection metadata
Returns:
true if the getValue() can return null without generating a faulty injection operation

getValue

public abstract java.lang.Object getValue(java.lang.Object component,
                                          java.lang.reflect.AnnotatedElement annotated,
                                          java.lang.Class type)
                                   throws ComponentException
Returns the value to inject in the field or method of component annotated with the annotated annotation.

Parameters:
component - injection target
annotated - field of method to inject
type - type of the expected return
Returns:
the injectable resource
Throws:
ComponentException - if the resource cannot be located.


Copyright © 2009 Sun Microsystems, Inc.. All Rights Reserved.