org.jboss.webbeans.introspector.jlr
Class AnnotatedFieldImpl<T>

java.lang.Object
  extended by org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem<T,S>
      extended by org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember<T,java.lang.reflect.Field>
          extended by org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl<T>
Type Parameters:
T -
All Implemented Interfaces:
AnnotatedField<T>, AnnotatedItem<T,java.lang.reflect.Field>, AnnotatedMember<T,java.lang.reflect.Field>

public class AnnotatedFieldImpl<T>
extends AbstractAnnotatedMember<T,java.lang.reflect.Field>
implements AnnotatedField<T>

Represents an annotated field This class is immutable, and therefore threadsafe

Author:
Pete Muir

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember
AbstractAnnotatedMember.AnnotatedParameterMap
 
Field Summary
 
Fields inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
MAPPED_METAANNOTATIONS
 
Constructor Summary
AnnotatedFieldImpl(java.lang.reflect.Field field, AnnotatedType<?> declaringClass)
          Constructor Initializes the superclass with the built annotation map and detects the type arguments
 
Method Summary
 T get(java.lang.Object instance)
           
 java.lang.reflect.Type[] getActualTypeArguments()
          Gets the actual type arguments
 java.lang.reflect.Field getAnnotatedField()
          Gets the underlying field
 AnnotatedType<?> getDeclaringClass()
          Gets the abstracted declaring class
 java.lang.reflect.Field getDelegate()
           
 java.lang.String getPropertyName()
          Gets the property name
 java.lang.Class<T> getType()
          Gets the type
 void set(java.lang.Object instance, java.lang.Object value)
          Injects an instance
 void setOnInstance(java.lang.Object instance, java.lang.Object value)
          Injects into the field using the value provided by the manager Unlike #set(Object, Manager) the field injected into is discovered from the declaring instance.
 java.lang.String toString()
          Gets a string representation of the field
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedMember
getMember, getName, getValue, isFinal, isPublic, isStatic, isTransient
 
Methods inherited from class org.jboss.webbeans.introspector.jlr.AbstractAnnotatedItem
equals, getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindingTypes, getBindingTypesAsArray, getDeclaredMetaAnnotations, getMetaAnnotations, getMetaAnnotationsAsArray, hashCode, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isProxyable
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedField
isTransient
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedMember
getMember
 
Methods inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindingTypes, getBindingTypesAsArray, getDeclaredMetaAnnotations, getMetaAnnotations, getMetaAnnotationsAsArray, getName, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isFinal, isProxyable, isPublic, isStatic
 

Constructor Detail

AnnotatedFieldImpl

public AnnotatedFieldImpl(java.lang.reflect.Field field,
                          AnnotatedType<?> declaringClass)
Constructor Initializes the superclass with the built annotation map and detects the type arguments

Parameters:
field - The actual field
declaringClass - The abstraction of the declaring class
Method Detail

getAnnotatedField

public java.lang.reflect.Field getAnnotatedField()
Gets the underlying field

Specified by:
getAnnotatedField in interface AnnotatedField<T>
Returns:
The fields

getDelegate

public java.lang.reflect.Field getDelegate()
Specified by:
getDelegate in class AbstractAnnotatedItem<T,java.lang.reflect.Field>

getType

public java.lang.Class<T> getType()
Gets the type

Specified by:
getType in interface AnnotatedItem<T,java.lang.reflect.Field>
Returns:
The type

getActualTypeArguments

public java.lang.reflect.Type[] getActualTypeArguments()
Gets the actual type arguments

Specified by:
getActualTypeArguments in interface AnnotatedItem<T,java.lang.reflect.Field>
Returns:
The type arguments
See Also:
AnnotatedItem.getActualTypeArguments()

set

public void set(java.lang.Object instance,
                java.lang.Object value)
         throws java.lang.IllegalArgumentException,
                java.lang.IllegalAccessException
Description copied from interface: AnnotatedField
Injects an instance

Specified by:
set in interface AnnotatedField<T>
Parameters:
instance - The instance to inject into
value - The value to inject
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalAccessException

setOnInstance

public void setOnInstance(java.lang.Object instance,
                          java.lang.Object value)
                   throws java.lang.IllegalArgumentException,
                          java.lang.SecurityException,
                          java.lang.IllegalAccessException,
                          java.lang.NoSuchFieldException
Description copied from interface: AnnotatedField
Injects into the field using the value provided by the manager Unlike #set(Object, Manager) the field injected into is discovered from the declaring instance. This is slower, but safe to use with proxies.

Specified by:
setOnInstance in interface AnnotatedField<T>
Parameters:
instance - The instance to inject into
value - The value to inject
Throws:
java.lang.IllegalArgumentException
java.lang.SecurityException
java.lang.IllegalAccessException
java.lang.NoSuchFieldException

get

public T get(java.lang.Object instance)
Specified by:
get in interface AnnotatedField<T>

getPropertyName

public java.lang.String getPropertyName()
Gets the property name

Specified by:
getPropertyName in interface AnnotatedField<T>
Returns:
The property name
See Also:
AnnotatedItem.getName()

getDeclaringClass

public AnnotatedType<?> getDeclaringClass()
Gets the abstracted declaring class

Specified by:
getDeclaringClass in interface AnnotatedField<T>
Returns:
The declaring class
See Also:
AnnotatedField.getDeclaringClass()

toString

public java.lang.String toString()
Gets a string representation of the field

Overrides:
toString in class AbstractAnnotatedMember<T,java.lang.reflect.Field>
Returns:
A string representation


Copyright © 2008-2009. All Rights Reserved.