JBoss Reflection 2.2.1.SP1

org.jboss.reflect.plugins.javassist
Class JavassistTypeInfo

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.JavassistInheritableAnnotationHolder
                  extended by org.jboss.reflect.plugins.javassist.JavassistTypeInfo
All Implemented Interfaces:
Serializable, Cloneable, AnnotatedInfo, ClassInfo, InterfaceInfo, ModifierInfo, MutableClassInfo, TypeInfo, org.jboss.util.JBossInterface
Direct Known Subclasses:
JavassistAnnotationInfo, JavassistArrayInfoImpl, JavassistEnumInfo

public class JavassistTypeInfo
extends JavassistInheritableAnnotationHolder
implements MutableClassInfo, InterfaceInfo

JavassistTypeInfo.

Version:
$Revision: 106445 $
Author:
Adrian Brock
See Also:
Serialized Form

Nested Class Summary
static class JavassistTypeInfo.MarshalledClassInfo
           
 
Field Summary
protected static RuntimePermission GET_CLASSLOADER_PERMISSION
          The get classloader permission
 
Fields inherited from class org.jboss.reflect.plugins.javassist.JavassistInheritableAnnotationHolder
allAnnotations, allAnnotationsArray, ctClass, initialized
 
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
 
Method Summary
 void addConstructor(MutableConstructorInfo mci)
          Add a constructor
 void addField(MutableFieldInfo mfi)
          Add a field
 void addMethod(MutableMethodInfo mmi)
          Add a method
protected  void clearConstructorCache()
           
protected  void clearFieldCache()
           
protected  void clearMethodCache()
           
 Object convertValue(Object value)
          Convert a value
 Object convertValue(Object value, boolean replaceProperties)
          Convert a value
 Object convertValue(Object value, boolean replaceProperties, boolean trim)
          Convert a value
 MutableConstructorInfo createMutableConstructor(Body body)
          Compiles the code included in the Body parameter and returns a MutableConstructorInfo representation of it.
 MutableConstructorInfo createMutableConstructor(int modifiers, Body body, ClassInfo[] parameters, ClassInfo[] exceptions)
          Creates a constructor with the parameters given.
 MutableConstructorInfo createMutableConstructor(int modifiers, Body body, String[] parameters, String[] exceptions)
          Creates a constructor with the parameters given.
 MutableConstructorInfo createMutableConstructor(int modifiers, ClassInfo[] parameters, ClassInfo[] exceptions)
          Creates an empty constructor with the parameters given.
 MutableConstructorInfo createMutableConstructor(int modifiers, String[] parameters, String[] exceptions)
          Creates an empty constructor with parameters given.
 MutableFieldInfo createMutableField(int modifiers, ClassInfo type, String fieldName)
          Creates a field connected to this class with the parameters given.
 MutableFieldInfo createMutableField(int modifiers, String type, String fieldName)
          Creates a field connected to this class with the parameters given.
 MutableMethodInfo createMutableMethod(Body body)
          Compiles the code included in Body and returns a MutableMethodInfo representation of it.
 MutableMethodInfo createMutableMethod(int modifiers, ClassInfo returnType, String methodName, Body body, ClassInfo[] parameters, ClassInfo[] exceptions)
          Compiles a method with the signature and body given by the parameters.
 MutableMethodInfo createMutableMethod(int modifiers, ClassInfo returnType, String methodName, ClassInfo[] parameters, ClassInfo[] exceptions)
          Compiles an empty method with the signature given by the parameters.
 MutableMethodInfo createMutableMethod(int modifiers, String returnType, String methodName, Body body, String[] parameters, String[] exceptions)
          Compiles a method with the signature and body given by the parameters.
 MutableMethodInfo createMutableMethod(int modifiers, String returnType, String methodName, String[] parameters, String[] exceptions)
          Compiles an empty method with the signature given by the parameters.
 boolean equals(Object obj)
           
protected  MutableConstructorInfo generateConstructorInfo(javassist.CtConstructor constructor)
          Generate constructor info
protected  MutableConstructorInfo generateConstructorInfo(SignatureKey key)
          Generate constructor info
protected  MutableFieldInfo generateFieldInfo(javassist.CtField field)
          Generate field info
protected  MutableMethodInfo generateMethodInfo(javassist.CtMethod method)
          Generate method info
protected  MutableMethodInfo generateMethodInfo(SignatureKey key)
          Generate method info
protected  MutableMethodInfo generateMethodInfo(SignatureKey key, javassist.CtMethod method)
          Generate method info
 TypeInfo[] getActualTypeArguments()
          Get the actual type parameters
protected  Object getAnnotatedTarget()
           
 AnnotationValue[] getAnnotations()
          Get the annotations
static Class<?> getArrayClass(Class<?> clazz)
          Get an array class
 TypeInfo getArrayType()
          Get an array type
<T> T
getAttachment(Class<T> expectedType)
          Get an attachment from the type, uses the expected type as both the name and to cast the resulting object.
 Object getAttachment(String attachmentName)
          Get an attachment from the type
 ClassLoader getClassLoader()
          Get the classloader for this class info.
 ClassLoader getClassLoaderInternal()
           
 javassist.bytecode.SignatureAttribute.ClassSignature getClassSignature()
           
 TypeInfo getComponentType()
          Get the component type if it is a collection or an array
 MutableConstructorInfo getDeclaredConstructor()
          Gets the default constructor (parameterless)
 MutableConstructorInfo getDeclaredConstructor(String... parameters)
          Get a declared constructor Note: the parameters will be loaded with the classloader defined in TypeInfoFactory.
 MutableConstructorInfo getDeclaredConstructor(TypeInfo... parameters)
          Get a declared constructor
 MutableConstructorInfo[] getDeclaredConstructors()
          Get the declared constructors
 MutableFieldInfo getDeclaredField(String fieldName)
          Get the declared field
 MutableFieldInfo[] getDeclaredFields()
          Get the declared fields
 MutableMethodInfo getDeclaredMethod(String methodName)
          Get the declared method without parameters.
 MutableMethodInfo getDeclaredMethod(String methodName, String... parameters)
          Get the declared method Note: the parameters will be loaded with the classloader defined in TypeInfoFactory.
 MutableMethodInfo getDeclaredMethod(String methodName, TypeInfo... parameters)
          Get the declared method
 MutableMethodInfo[] getDeclaredMethods()
          Get the declared methods
 JavassistTypeInfoFactoryImpl getFactory()
          Get the factory
 InterfaceInfo[] getGenericInterfaces()
          Get the generic interfaces
 ClassInfo getGenericSuperclass()
          Get the generic super class
protected  int getHashCode()
           
 InterfaceInfo[] getInterfaces()
          Get the interfaces
 TypeInfo getKeyType()
          Get the key type if it is a map
 int getModifiers()
          Get the modifiers
 String getName()
          Get the class name
 TypeInfo getOwnerType()
          Get the owner type
 PackageInfo getPackage()
          Get the package
protected  javassist.CtClass[] getParameterTypes(SignatureKey key)
          Get the parameter types
 ClassInfo getRawType()
          Get the raw type
 String getSimpleName()
          Get the simple name
 ClassInfo getSuperclass()
          Get the super class
 ClassInfo getSuperHolder()
           
 Class<? extends Object> getType()
          Deprecated. 
 TypeInfoFactory getTypeInfoFactory()
          Get the TypeInfoFactory that created this type info
 String getTypeVariable()
          Gets the type variable if we are a parameterized type which is part of a parameterized type and there is a type variable for this type.
 TypeInfo getValueType()
          Get the value type if it is a map
 boolean isAnnotation()
          Whether this type is an annotation
 boolean isArray()
          Whether this type is an array
 boolean isAssignableFrom(TypeInfo info)
          Mostly using
 boolean isCollection()
          Whether this type is a collection
 boolean isEnum()
          Whether this type is an enum
 boolean isInstance(Object object)
          Is object instance of this type info.
 boolean isInterface()
          Whether it is an interface
 boolean isMap()
          Whether this type is a map
 boolean isPrimitive()
          Whether this type is a primitive
 boolean isPublic()
           
 boolean isStatic()
          Whether it is static
 boolean isVolatile()
          Whether it is volatile
 Object newArrayInstance(int size)
          Create a new array
 void removeConstructor(MutableConstructorInfo mci)
          Remove the specified constructor from this class
 void removeField(MutableFieldInfo mfi)
          Remove a field
 void removeMethod(MutableMethodInfo mmi)
          Remove the specified method from this class
 void setAttachment(String name, Object attachment)
          Set an attachment against the type.
 byte[] toByteCode()
          Converts the class to a Class file.
 void toShortString(org.jboss.util.JBossStringBuilder buffer)
           
protected  void toString(org.jboss.util.JBossStringBuilder buffer)
           
protected  Object writeReplace()
           
 
Methods inherited from class org.jboss.reflect.plugins.javassist.JavassistInheritableAnnotationHolder
getAllAnnotations, 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

GET_CLASSLOADER_PERMISSION

protected static final RuntimePermission GET_CLASSLOADER_PERMISSION
The get classloader permission

Method Detail

getName

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

Specified by:
getName in interface ClassInfo
Specified by:
getName in interface TypeInfo
Returns:
the name

isInterface

public boolean isInterface()
Description copied from interface: ClassInfo
Whether it is an interface

Specified by:
isInterface in interface ClassInfo
Returns:
true when an interface

getSimpleName

public String getSimpleName()
Description copied from interface: TypeInfo
Get the simple name

Specified by:
getSimpleName in interface TypeInfo
Returns:
the simple 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

getType

@Deprecated
public Class<? extends Object> getType()
Deprecated. 

Description copied from interface: TypeInfo
Get the class

Specified by:
getType in interface TypeInfo
Returns:
the class

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: TypeInfo
Get the classloader for this class info. Delay type creation if possible.

Specified by:
getClassLoader in interface TypeInfo
Returns:
class info's classloader

getClassLoaderInternal

public ClassLoader getClassLoaderInternal()

getSuperclass

public ClassInfo getSuperclass()
Description copied from interface: ClassInfo
Get the super class

Specified by:
getSuperclass in interface ClassInfo
Returns:
the super class

getGenericSuperclass

public ClassInfo getGenericSuperclass()
Description copied from interface: ClassInfo
Get the generic super class

Specified by:
getGenericSuperclass in interface ClassInfo
Returns:
the super class

getInterfaces

public InterfaceInfo[] getInterfaces()
Description copied from interface: ClassInfo
Get the interfaces

Specified by:
getInterfaces in interface ClassInfo
Returns:
the interfaces

getGenericInterfaces

public InterfaceInfo[] getGenericInterfaces()
Description copied from interface: ClassInfo
Get the generic interfaces

Specified by:
getGenericInterfaces in interface ClassInfo
Returns:
the generic interfaces

getDeclaredConstructors

public MutableConstructorInfo[] getDeclaredConstructors()
Description copied from interface: MutableClassInfo
Get the declared constructors

Specified by:
getDeclaredConstructors in interface ClassInfo
Specified by:
getDeclaredConstructors in interface MutableClassInfo
Returns:
the constructors

getDeclaredConstructor

public MutableConstructorInfo getDeclaredConstructor()
Description copied from interface: MutableClassInfo
Gets the default constructor (parameterless)

Specified by:
getDeclaredConstructor in interface MutableClassInfo
Returns:
the constructor

getDeclaredConstructor

public MutableConstructorInfo getDeclaredConstructor(TypeInfo... parameters)
Description copied from interface: MutableClassInfo
Get a declared constructor

Specified by:
getDeclaredConstructor in interface ClassInfo
Specified by:
getDeclaredConstructor in interface MutableClassInfo
Parameters:
parameters - the parameters
Returns:
the constructor

getDeclaredConstructor

public MutableConstructorInfo getDeclaredConstructor(String... parameters)
                                              throws ClassNotFoundException
Description copied from interface: MutableClassInfo
Get a declared constructor Note: the parameters will be loaded with the classloader defined in TypeInfoFactory.

Specified by:
getDeclaredConstructor in interface MutableClassInfo
Parameters:
parameters - the parameters
Returns:
the constructor
Throws:
ClassNotFoundException

getDeclaredField

public MutableFieldInfo getDeclaredField(String fieldName)
Description copied from interface: MutableClassInfo
Get the declared field

Specified by:
getDeclaredField in interface ClassInfo
Specified by:
getDeclaredField in interface MutableClassInfo
Parameters:
fieldName - the field name
Returns:
the field

getDeclaredFields

public MutableFieldInfo[] getDeclaredFields()
Description copied from interface: MutableClassInfo
Get the declared fields

Specified by:
getDeclaredFields in interface ClassInfo
Specified by:
getDeclaredFields in interface MutableClassInfo
Returns:
the fields

getDeclaredMethod

public MutableMethodInfo getDeclaredMethod(String methodName)
Description copied from interface: MutableClassInfo
Get the declared method without parameters.

Specified by:
getDeclaredMethod in interface MutableClassInfo
Parameters:
methodName - the method name
Returns:
the method info

getDeclaredMethod

public MutableMethodInfo getDeclaredMethod(String methodName,
                                           TypeInfo... parameters)
Description copied from interface: MutableClassInfo
Get the declared method

Specified by:
getDeclaredMethod in interface ClassInfo
Specified by:
getDeclaredMethod in interface MutableClassInfo
Parameters:
methodName - the method name
parameters - the parameters
Returns:
the method info

getDeclaredMethod

public MutableMethodInfo getDeclaredMethod(String methodName,
                                           String... parameters)
                                    throws ClassNotFoundException
Description copied from interface: MutableClassInfo
Get the declared method Note: the parameters will be loaded with the classloader defined in TypeInfoFactory.

Specified by:
getDeclaredMethod in interface MutableClassInfo
Parameters:
methodName - the method name
parameters - the parameters
Returns:
the method info
Throws:
ClassNotFoundException

getDeclaredMethods

public MutableMethodInfo[] getDeclaredMethods()
Description copied from interface: MutableClassInfo
Get the declared methods

Specified by:
getDeclaredMethods in interface ClassInfo
Specified by:
getDeclaredMethods in interface MutableClassInfo
Returns:
the methods

isArray

public boolean isArray()
Description copied from interface: TypeInfo
Whether this type is an array

Specified by:
isArray in interface TypeInfo
Returns:
true when an array

isCollection

public boolean isCollection()
Description copied from interface: TypeInfo
Whether this type is a collection

Specified by:
isCollection in interface TypeInfo
Returns:
true when a collection

isMap

public boolean isMap()
Description copied from interface: TypeInfo
Whether this type is a map

Specified by:
isMap in interface TypeInfo
Returns:
true when a map

isAnnotation

public boolean isAnnotation()
Description copied from interface: TypeInfo
Whether this type is an annotation

Specified by:
isAnnotation in interface TypeInfo
Returns:
true when an annotation

isEnum

public boolean isEnum()
Description copied from interface: TypeInfo
Whether this type is an enum

Specified by:
isEnum in interface TypeInfo
Returns:
true when an enum

isPrimitive

public boolean isPrimitive()
Description copied from interface: TypeInfo
Whether this type is a primitive

Specified by:
isPrimitive in interface TypeInfo
Returns:
true when a primtive

getArrayClass

public static Class<?> getArrayClass(Class<?> clazz)
Get an array class

Parameters:
clazz - the class
Returns:
the array class

getArrayType

public TypeInfo getArrayType()
Description copied from interface: TypeInfo
Get an array type

Specified by:
getArrayType in interface TypeInfo
Returns:
the array type

newArrayInstance

public Object newArrayInstance(int size)
                        throws Throwable
Description copied from interface: TypeInfo
Create a new array

Specified by:
newArrayInstance in interface TypeInfo
Parameters:
size - the size
Returns:
the converted value
Throws:
Throwable - for any error

isAssignableFrom

public boolean isAssignableFrom(TypeInfo info)
Description copied from interface: TypeInfo
Mostly using

Specified by:
isAssignableFrom in interface TypeInfo
Parameters:
info - type info
Returns:
the boolean value indicating whether objects of the TypeInfo info can be assigned to objects of this TypeInfo
See Also:
PrimitiveInfo tests for progression

isInstance

public boolean isInstance(Object object)
Description copied from interface: TypeInfo
Is object instance of this type info.

Specified by:
isInstance in interface TypeInfo
Parameters:
object - the object to check
Returns:
true if object is an instance of this class
See Also:
PrimitiveInfo tests for progression

getTypeInfoFactory

public TypeInfoFactory getTypeInfoFactory()
Description copied from interface: TypeInfo
Get the TypeInfoFactory that created this type info

Specified by:
getTypeInfoFactory in interface TypeInfo
Returns:
type info factory

convertValue

public Object convertValue(Object value)
                    throws Throwable
Description copied from interface: TypeInfo
Convert a value

Specified by:
convertValue in interface TypeInfo
Parameters:
value - the original value
Returns:
the converted value
Throws:
Throwable - for any error

convertValue

public Object convertValue(Object value,
                           boolean replaceProperties)
                    throws Throwable
Description copied from interface: TypeInfo
Convert a value

Specified by:
convertValue in interface TypeInfo
Parameters:
value - the original value
replaceProperties - whether to replace properties
Returns:
the converted value
Throws:
Throwable - for any error

convertValue

public Object convertValue(Object value,
                           boolean replaceProperties,
                           boolean trim)
                    throws Throwable
Description copied from interface: TypeInfo
Convert a value

Specified by:
convertValue in interface TypeInfo
Parameters:
value - the original value
replaceProperties - whether to replace properties
trim - do we trim before conversion
Returns:
the converted value
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

getFactory

public JavassistTypeInfoFactoryImpl getFactory()
Get the factory

Returns:
the factory

generateConstructorInfo

protected MutableConstructorInfo generateConstructorInfo(javassist.CtConstructor constructor)
Generate constructor info

Parameters:
constructor - the constructor
Returns:
the constructor info

generateConstructorInfo

protected MutableConstructorInfo generateConstructorInfo(SignatureKey key)
Generate constructor info

Parameters:
key - the key
Returns:
the constructor info

generateFieldInfo

protected MutableFieldInfo generateFieldInfo(javassist.CtField field)
Generate field info

Parameters:
field - the field
Returns:
the field info

generateMethodInfo

protected MutableMethodInfo generateMethodInfo(SignatureKey key)
Generate method info

Parameters:
key - the key
Returns:
the method info

generateMethodInfo

protected MutableMethodInfo generateMethodInfo(javassist.CtMethod method)
Generate method info

Parameters:
method - the method
Returns:
the method info

generateMethodInfo

protected MutableMethodInfo generateMethodInfo(SignatureKey key,
                                               javassist.CtMethod method)
Generate method info

Parameters:
key - the key
method - the method
Returns:
the method info or null if the method is volatile

getParameterTypes

protected javassist.CtClass[] getParameterTypes(SignatureKey key)
Get the parameter types

Parameters:
key - the key
Returns:
the parameter types

getAnnotatedTarget

protected Object getAnnotatedTarget()

getAnnotations

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

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

getSuperHolder

public ClassInfo getSuperHolder()
Specified by:
getSuperHolder in class JavassistInheritableAnnotationHolder

getActualTypeArguments

public TypeInfo[] getActualTypeArguments()
Description copied from interface: ClassInfo
Get the actual type parameters

Specified by:
getActualTypeArguments in interface ClassInfo
Returns:
the type parameters. If there are none, a zero length array is returned

getOwnerType

public TypeInfo getOwnerType()
Description copied from interface: ClassInfo
Get the owner type

Specified by:
getOwnerType in interface ClassInfo
Returns:
the owner type

getRawType

public ClassInfo getRawType()
Description copied from interface: ClassInfo
Get the raw type

Specified by:
getRawType in interface ClassInfo
Returns:
the raw type

getComponentType

public TypeInfo getComponentType()
Description copied from interface: ClassInfo
Get the component type if it is a collection or an array

Specified by:
getComponentType in interface ClassInfo
Returns:
the component type

getKeyType

public TypeInfo getKeyType()
Description copied from interface: ClassInfo
Get the key type if it is a map

Specified by:
getKeyType in interface ClassInfo
Returns:
the key type

getValueType

public TypeInfo getValueType()
Description copied from interface: ClassInfo
Get the value type if it is a map

Specified by:
getValueType in interface ClassInfo
Returns:
the value type

getPackage

public PackageInfo getPackage()
Description copied from interface: ClassInfo
Get the package

Specified by:
getPackage in interface ClassInfo
Returns:
the package

setAttachment

public void setAttachment(String name,
                          Object attachment)
Description copied from interface: TypeInfo
Set an attachment against the type. This is useful for caching information against a type.

If you add a future object, subsequent gets will wait for the result

WARNING: Be careful about what you put in here. Don't create references across classloaders, if you are not sure add a WeakReference to the information.

Specified by:
setAttachment in interface TypeInfo
Parameters:
name - the name
attachment - the attachment, pass null to remove an attachment

getAttachment

public <T> T getAttachment(Class<T> expectedType)
Description copied from interface: TypeInfo
Get an attachment from the type, uses the expected type as both the name and to cast the resulting object.

Specified by:
getAttachment in interface TypeInfo
Type Parameters:
T - the expected type
Parameters:
expectedType - the expected type
Returns:
the attachment

getAttachment

public Object getAttachment(String attachmentName)
Description copied from interface: TypeInfo
Get an attachment from the type

Specified by:
getAttachment in interface TypeInfo
Parameters:
attachmentName - the name
Returns:
the attachment

clearMethodCache

protected void clearMethodCache()

clearConstructorCache

protected void clearConstructorCache()

clearFieldCache

protected void clearFieldCache()

addConstructor

public void addConstructor(MutableConstructorInfo mci)
Description copied from interface: MutableClassInfo
Add a constructor

Specified by:
addConstructor in interface MutableClassInfo

addField

public void addField(MutableFieldInfo mfi)
Description copied from interface: MutableClassInfo
Add a field

Specified by:
addField in interface MutableClassInfo

addMethod

public void addMethod(MutableMethodInfo mmi)
Description copied from interface: MutableClassInfo
Add a method

Specified by:
addMethod in interface MutableClassInfo

createMutableConstructor

public MutableConstructorInfo createMutableConstructor(Body body)
Description copied from interface: MutableClassInfo
Compiles the code included in the Body parameter and returns a MutableConstructorInfo representation of it. The Body must include the whole declaration. The

Specified by:
createMutableConstructor in interface MutableClassInfo
Parameters:
body - contains the code of the constructor to be created
Returns:
the created constructor

createMutableConstructor

public MutableConstructorInfo createMutableConstructor(int modifiers,
                                                       String[] parameters,
                                                       String[] exceptions)
Description copied from interface: MutableClassInfo
Creates an empty constructor with parameters given.

Specified by:
createMutableConstructor in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the constructor to be created
parameters - the parameters of the constructor to be created
exceptions - the exceptions that the constructor to be created declares to throw
Returns:
the created constructor

createMutableConstructor

public MutableConstructorInfo createMutableConstructor(int modifiers,
                                                       ClassInfo[] parameters,
                                                       ClassInfo[] exceptions)
Description copied from interface: MutableClassInfo
Creates an empty constructor with the parameters given.

Specified by:
createMutableConstructor in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the constructor to be created
parameters - the parameters of the constructor to be created
exceptions - the exceptions that the constructor to be created declares to throw
Returns:
the created constructor

createMutableConstructor

public MutableConstructorInfo createMutableConstructor(int modifiers,
                                                       Body body,
                                                       String[] parameters,
                                                       String[] exceptions)
Description copied from interface: MutableClassInfo
Creates a constructor with the parameters given. Note that the source text of the Body must be surrounded by {}.

Specified by:
createMutableConstructor in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the constructor to be created
body - the body of the constructor to be created
parameters - the parameters of the constructor to be created
exceptions - the exceptions that the constructor to be created declares to throw
Returns:
the created constructor

createMutableConstructor

public MutableConstructorInfo createMutableConstructor(int modifiers,
                                                       Body body,
                                                       ClassInfo[] parameters,
                                                       ClassInfo[] exceptions)
Description copied from interface: MutableClassInfo
Creates a constructor with the parameters given. Note that the source text of the Body must be surrounded by {}.

Specified by:
createMutableConstructor in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the constructor to be created
body - the body of the constructor to be created
parameters - the parameters of the constructor to be created
exceptions - the exceptions that the constructor to be created declares to throw
Returns:
the created constructor

createMutableField

public MutableFieldInfo createMutableField(int modifiers,
                                           String type,
                                           String fieldName)
Description copied from interface: MutableClassInfo
Creates a field connected to this class with the parameters given.

Specified by:
createMutableField in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the field to be created
type - the type of the field to be created
fieldName - the name of the field to be created
Returns:
the created field

createMutableField

public MutableFieldInfo createMutableField(int modifiers,
                                           ClassInfo type,
                                           String fieldName)
Description copied from interface: MutableClassInfo
Creates a field connected to this class with the parameters given.

Specified by:
createMutableField in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the field to be created
type - the type of the field to be created
fieldName - the name of the field to be created
Returns:
the created field

createMutableMethod

public MutableMethodInfo createMutableMethod(Body body)
Description copied from interface: MutableClassInfo
Compiles the code included in Body and returns a MutableMethodInfo representation of it. The Body must include the whole declaration of the method.

Specified by:
createMutableMethod in interface MutableClassInfo
Parameters:
body - contains the entire declaration of the method, including its signature
Returns:
the created method

createMutableMethod

public MutableMethodInfo createMutableMethod(int modifiers,
                                             String returnType,
                                             String methodName,
                                             String[] parameters,
                                             String[] exceptions)
Description copied from interface: MutableClassInfo
Compiles an empty method with the signature given by the parameters.

Specified by:
createMutableMethod in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
methodName - the name of the method to be created
parameters - the parameters of the method to be created
exceptions - the exceptions that the method to be created declares to throw
Returns:
the created method

createMutableMethod

public MutableMethodInfo createMutableMethod(int modifiers,
                                             ClassInfo returnType,
                                             String methodName,
                                             ClassInfo[] parameters,
                                             ClassInfo[] exceptions)
Description copied from interface: MutableClassInfo
Compiles an empty method with the signature given by the parameters.

Specified by:
createMutableMethod in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
methodName - the name of the method to be created
parameters - the parameters of the method to be created
exceptions - the exceptions that the method to be created declares to throw
Returns:
the created method

createMutableMethod

public MutableMethodInfo createMutableMethod(int modifiers,
                                             String returnType,
                                             String methodName,
                                             Body body,
                                             String[] parameters,
                                             String[] exceptions)
Description copied from interface: MutableClassInfo
Compiles a method with the signature and body given by the parameters. Note that the source code of the body must be surrounded by {}.

Specified by:
createMutableMethod in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
methodName - the name of the method to be created
body - the body of the method to be created
parameters - the parameters of the method to be created
exceptions - the exceptions that the method to be created declares to throw
Returns:
the created method

createMutableMethod

public MutableMethodInfo createMutableMethod(int modifiers,
                                             ClassInfo returnType,
                                             String methodName,
                                             Body body,
                                             ClassInfo[] parameters,
                                             ClassInfo[] exceptions)
Description copied from interface: MutableClassInfo
Compiles a method with the signature and body given by the parameters. Note that the source code of the body must be surrounded by {}.

Specified by:
createMutableMethod in interface MutableClassInfo
Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
methodName - the name of the method to be created
body - the body of the method to be created
parameters - the parameters of the method to be created
exceptions - the exceptions that the method to be created declares to throw
Returns:
the created method

removeConstructor

public void removeConstructor(MutableConstructorInfo mci)
Description copied from interface: MutableClassInfo
Remove the specified constructor from this class

Specified by:
removeConstructor in interface MutableClassInfo

removeField

public void removeField(MutableFieldInfo mfi)
Description copied from interface: MutableClassInfo
Remove a field

Specified by:
removeField in interface MutableClassInfo

removeMethod

public void removeMethod(MutableMethodInfo mmi)
Description copied from interface: MutableClassInfo
Remove the specified method from this class

Specified by:
removeMethod in interface MutableClassInfo

toByteCode

public byte[] toByteCode()
Description copied from interface: MutableClassInfo
Converts the class to a Class file. After this method is called, no modifications to the class are allowed.

Specified by:
toByteCode in interface MutableClassInfo
Returns:
this class in bytecodes

writeReplace

protected Object writeReplace()

getTypeVariable

public String getTypeVariable()
Description copied from interface: ClassInfo
Gets the type variable if we are a parameterized type which is part of a parameterized type and there is a type variable for this type. This is useful in avoiding infinite recursion

Specified by:
getTypeVariable in interface ClassInfo
Returns:
the type variable

getClassSignature

public javassist.bytecode.SignatureAttribute.ClassSignature getClassSignature()

JBoss Reflection 2.2.1.SP1

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