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

Field Summary
 
Fields inherited from interface org.jboss.webbeans.introspector.AnnotatedItem
MAPPED_METAANNOTATIONS
 
Constructor Summary
protected AnnotatedFieldImpl(java.lang.reflect.Field field, AnnotatedType<?> declaringClass)
          Constructor Initializes the superclass with the built annotation map and detects the type arguments
 
Method Summary
 boolean equals(java.lang.Object other)
          Compares two AbstractAnnotatedItems
 T get(java.lang.Object instance)
           
 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
 int hashCode()
          Gets the hash code of the actual type
 void set(java.lang.Object instance, java.lang.Object value)
          Injects an instance
 void setOnInstance(java.lang.Object instance, java.lang.Object value)
           
 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
getActualTypeArguments, getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindings, getBindingsAsArray, getDeclaredMetaAnnotations, getFlattenedTypeHierarchy, getMetaAnnotations, getMetaAnnotationsAsArray, getRawType, getType, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isParameterizedType, 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
getActualTypeArguments, getAnnotation, getAnnotationsAsSet, getAnnotationStore, getBindings, getBindingsAsArray, getDeclaredMetaAnnotations, getFlattenedTypeHierarchy, getMetaAnnotations, getMetaAnnotationsAsArray, getName, getRawType, getType, isAnnotationPresent, isAssignableFrom, isAssignableFrom, isDeclaredAnnotationPresent, isFinal, isParameterizedType, isProxyable, isPublic, isStatic
 

Constructor Detail

AnnotatedFieldImpl

protected 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>

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
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>
Specified by:
getDeclaringClass in interface AnnotatedMember<T,java.lang.reflect.Field>
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

equals

public boolean equals(java.lang.Object other)
Description copied from class: AbstractAnnotatedItem
Compares two AbstractAnnotatedItems

Overrides:
equals in class AbstractAnnotatedItem<T,java.lang.reflect.Field>
Parameters:
other - The other item
Returns:
True if equals, false otherwise

hashCode

public int hashCode()
Description copied from class: AbstractAnnotatedItem
Gets the hash code of the actual type

Overrides:
hashCode in class AbstractAnnotatedItem<T,java.lang.reflect.Field>
Returns:
The hash code


Copyright © 2011. All Rights Reserved.