de.akquinet.jbosscc.needle.injection
Class InjectionTargetInformation

java.lang.Object
  extended by de.akquinet.jbosscc.needle.injection.InjectionTargetInformation

public class InjectionTargetInformation
extends Object

Provides information about the injection target.


Constructor Summary
InjectionTargetInformation(Class<?> type, Constructor<?> constructor, Annotation[] parameterAnnotations)
          Creates an instance of InjectionTargetInformation for Constructor injection.
InjectionTargetInformation(Class<?> type, Field field)
          Creates an instance of InjectionTargetInformation for Field injection.
InjectionTargetInformation(Class<?> type, Method method, Annotation[] parameterAnnotations)
          Creates an instance of InjectionTargetInformation for Method injection.
 
Method Summary
 AccessibleObject getAccessibleObject()
          Returns the AccessibleObject of the injection target.
<T> T
getAnnotation(Class<? extends Annotation> annotationClass)
          Returns the Annotation object if an annotation for the specified type is present on the injection target, otherwise null.
 Annotation[] getAnnotations()
          Returns an array of all annotations present on the injection target.
 Class<?> getType()
          Returns the class object from the injection target.
 boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
          Returns true if an annotation for the specified type is present on the injection target, else false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InjectionTargetInformation

public InjectionTargetInformation(Class<?> type,
                                  Field field)
Creates an instance of InjectionTargetInformation for Field injection.

Parameters:
type - class object of the injection target
field - Field object of the injection target

InjectionTargetInformation

public InjectionTargetInformation(Class<?> type,
                                  Method method,
                                  Annotation[] parameterAnnotations)
Creates an instance of InjectionTargetInformation for Method injection.

Parameters:
type - class object of the method parameter
method - Method object of the injection target
parameterAnnotations - annotations of method parameter

InjectionTargetInformation

public InjectionTargetInformation(Class<?> type,
                                  Constructor<?> constructor,
                                  Annotation[] parameterAnnotations)
Creates an instance of InjectionTargetInformation for Constructor injection.

Parameters:
type - class object of the constructor parameter
constructor - Constructor object of the injection target
parameterAnnotations - annotations of constructor parameter
Method Detail

getType

public Class<?> getType()
Returns the class object from the injection target.

Returns:
type of the injection target

getAnnotations

public Annotation[] getAnnotations()
Returns an array of all annotations present on the injection target. If the AccessibleObject of the injection target is of type Method or Constructor, then the Annotation of the AccessibleObject and the corresponding parameter are returned.

Returns:
Array of all annotations present on the injection target

getAccessibleObject

public AccessibleObject getAccessibleObject()
Returns the AccessibleObject of the injection target.

Returns:
the AccessibleObject of the injection target
See Also:
Field, Method, Constructor

isAnnotationPresent

public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
Returns true if an annotation for the specified type is present on the injection target, else false.

Parameters:
annotationClass - - the Class object corresponding to the annotation type
Returns:
true if an annotation for the specified annotation type is present on this element, else false
Throws:
NullPointerException - - if the given annotation class is null

getAnnotation

public <T> T getAnnotation(Class<? extends Annotation> annotationClass)
Returns the Annotation object if an annotation for the specified type is present on the injection target, otherwise null. If the AccessibleObject of the injection target is of type Method or Constructor, then the Annotation may be specified on the AccessibleObject or on the corresponding parameter.

Parameters:
annotationClass - - the Class object corresponding to the annotation type
Returns:
annotation for the specified annotation type if present on this element, otherwise null
Throws:
NullPointerException - - if the given annotation class is null


Copyright © 2013 akquinet AG. All Rights Reserved.