JBoss Reflection 2.2.1.SP1

org.jboss.reflect.plugins.javassist
Class JavassistFieldInfo

java.lang.Object
  extended by org.jboss.util.JBossObject
      extended by org.jboss.reflect.plugins.AbstractAnnotatedInfo
          extended by org.jboss.reflect.plugins.javassist.JavassistAnnotatedInfo
              extended by org.jboss.reflect.plugins.javassist.JavassistFieldInfo
All Implemented Interfaces:
Serializable, Cloneable, AnnotatedInfo, FieldInfo, MemberInfo, ModifierInfo, MutableFieldInfo, org.jboss.util.JBossInterface

public class JavassistFieldInfo
extends JavassistAnnotatedInfo
implements MutableFieldInfo

FieldInfo that relies on Javassist to answer reflective queries and to access the represented field. This class also relies on Javassist to perform the instrumentation operations defined in MutableFieldInfo.

Version:
$Revision: 105060 $
Author:
Adrian Brock
See Also:
MutableFieldInfo, Serialized Form

Field Summary
protected  JavassistTypeInfo typeInfo
          The type info
 
Fields inherited from class org.jboss.reflect.plugins.javassist.JavassistAnnotatedInfo
annotationHelper, annotationMap, annotationsArray
 
Fields inherited from class org.jboss.util.JBossObject
hashCode, log, toString
 
Fields inherited from interface org.jboss.reflect.spi.ModifierInfo
ABSTRACT, CONSTANT, FINAL, PACKAGE, PACKAGE_ABSTRACT, PACKAGE_CONSTANT, PACKAGE_STATIC, PRIVATE, PRIVATE_CONSTANT, PRIVATE_STATIC, PROTECTED, PROTECTED_ABSTRACT, PROTECTED_CONSTANT, PROTECTED_STATIC, PUBLIC, PUBLIC_ABSTRACT, PUBLIC_CONSTANT, PUBLIC_STATIC, STATIC
 
Constructor Summary
JavassistFieldInfo(AnnotationHelper annotationHelper, JavassistTypeInfo typeInfo, javassist.CtField ctField)
          Create a new JavassistFieldInfo.
 
Method Summary
 boolean equals(Object obj)
           
 Object get(Object target)
          Get the value of the field
 AnnotationValue[] getAnnotations()
          Get the annotations
 javassist.CtField getCtField()
           
 JavassistTypeInfo getDeclaringClass()
          Get the declaring class
 String getDescriptor()
           
protected  int getHashCode()
           
 int getModifiers()
          Get the modifiers
 String getName()
          Get the name
 TypeInfo getType()
          Get the field type
 boolean isPublic()
           
 boolean isStatic()
          Whether it is static
 boolean isVolatile()
          Whether it is volatile
 Object set(Object target, Object value)
          Set the value of the field
 void setModifier(ModifierInfo modifier)
          Field modifier
 void setName(String name)
          Name of the field
 void setType(ClassInfo type)
          Field type
 void setType(String type)
          Field type
 void toShortString(org.jboss.util.JBossStringBuilder buffer)
           
protected  void toString(org.jboss.util.JBossStringBuilder buffer)
           
 
Methods inherited from class org.jboss.reflect.plugins.javassist.JavassistAnnotatedInfo
getAnnotation, getAnnotations, isAnnotationPresent, setupAnnotations
 
Methods inherited from class org.jboss.reflect.plugins.AbstractAnnotatedInfo
getUnderlyingAnnotation, getUnderlyingAnnotations, isAnnotationPresent
 
Methods inherited from class org.jboss.util.JBossObject
cacheGetHashCode, cacheToString, clone, equals, flushJBossObjectCache, getClassShortName, hashCode, list, notEqual, toShortString, toString, toStringImplementation
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.reflect.spi.AnnotatedInfo
getAnnotation, getUnderlyingAnnotation, getUnderlyingAnnotations, isAnnotationPresent, isAnnotationPresent
 
Methods inherited from interface org.jboss.util.JBossInterface
clone, toShortString
 

Field Detail

typeInfo

protected final JavassistTypeInfo typeInfo
The type info

Constructor Detail

JavassistFieldInfo

public JavassistFieldInfo(AnnotationHelper annotationHelper,
                          JavassistTypeInfo typeInfo,
                          javassist.CtField ctField)
Create a new JavassistFieldInfo.

Parameters:
annotationHelper - the annotation helper
typeInfo - the type info
ctField - the field
Method Detail

getName

public String getName()
Description copied from interface: FieldInfo
Get the name

Specified by:
getName in interface FieldInfo
Returns:
the field name

getModifiers

public int getModifiers()
Description copied from interface: ModifierInfo
Get the modifiers

Specified by:
getModifiers in interface ModifierInfo
Returns:
the modifiers

isPublic

public boolean isPublic()
Specified by:
isPublic in interface ModifierInfo

isStatic

public boolean isStatic()
Description copied from interface: ModifierInfo
Whether it is static

Specified by:
isStatic in interface ModifierInfo
Returns:
true when static

isVolatile

public boolean isVolatile()
Description copied from interface: ModifierInfo
Whether it is volatile

Specified by:
isVolatile in interface ModifierInfo
Returns:
true if volatile

getDeclaringClass

public JavassistTypeInfo getDeclaringClass()
Description copied from interface: MemberInfo
Get the declaring class

Specified by:
getDeclaringClass in interface MemberInfo
Returns:
the declaring class

getType

public TypeInfo getType()
Description copied from interface: FieldInfo
Get the field type

Specified by:
getType in interface FieldInfo
Returns:
the field type

get

public Object get(Object target)
           throws Throwable
Description copied from interface: FieldInfo
Get the value of the field

Specified by:
get in interface FieldInfo
Parameters:
target - the target
Returns:
the field value
Throws:
Throwable - for any error

set

public Object set(Object target,
                  Object value)
           throws Throwable
Description copied from interface: FieldInfo
Set the value of the field

Specified by:
set in interface FieldInfo
Parameters:
target - the target
value - the value
Returns:
null
Throws:
Throwable - for any error

getHashCode

protected int getHashCode()
Overrides:
getHashCode in class org.jboss.util.JBossObject

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toShortString

public void toShortString(org.jboss.util.JBossStringBuilder buffer)
Specified by:
toShortString in interface org.jboss.util.JBossInterface
Overrides:
toShortString in class org.jboss.util.JBossObject

toString

protected void toString(org.jboss.util.JBossStringBuilder buffer)
Overrides:
toString in class org.jboss.util.JBossObject

getAnnotations

public AnnotationValue[] getAnnotations()
Description copied from interface: AnnotatedInfo
Get the annotations

Specified by:
getAnnotations in interface AnnotatedInfo
Returns:
the annotations. If there are no annotations a zero length array is returned

getCtField

public javassist.CtField getCtField()

setModifier

public void setModifier(ModifierInfo modifier)
Description copied from interface: MutableFieldInfo
Field modifier

Specified by:
setModifier in interface MutableFieldInfo

setName

public void setName(String name)
Description copied from interface: MutableFieldInfo
Name of the field

Specified by:
setName in interface MutableFieldInfo

setType

public void setType(ClassInfo type)
Description copied from interface: MutableFieldInfo
Field type

Specified by:
setType in interface MutableFieldInfo

setType

public void setType(String type)
Description copied from interface: MutableFieldInfo
Field type

Specified by:
setType in interface MutableFieldInfo

getDescriptor

public String getDescriptor()

JBoss Reflection 2.2.1.SP1

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.