JBoss Reflection 2.2.1.SP1

org.jboss.reflect.spi
Interface MutableClassInfo

All Superinterfaces:
AnnotatedInfo, ClassInfo, Cloneable, org.jboss.util.JBossInterface, ModifierInfo, Serializable, TypeInfo
All Known Implementing Classes:
JavassistAnnotationInfo, JavassistArrayInfoImpl, JavassistEnumInfo, JavassistTypeInfo

public interface MutableClassInfo
extends ClassInfo

A MutableClassInfo.

Version:
$Revision: 1.1 $
Author:
Stale W. Pedersen

Field Summary
 
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
 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 name)
          Creates a field connected to this class with the parameters given.
 MutableFieldInfo createMutableField(int modifiers, String type, String name)
          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 name, 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 name, ClassInfo[] parameters, ClassInfo[] exceptions)
          Compiles an empty method with the signature given by the parameters.
 MutableMethodInfo createMutableMethod(int modifiers, String returnType, String name, 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 name, String[] parameters, String[] exceptions)
          Compiles an empty method with the signature given by the parameters.
 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 name)
          Get the declared field
 MutableFieldInfo[] getDeclaredFields()
          Get the declared fields
 MutableMethodInfo getDeclaredMethod(String name)
          Get the declared method without parameters.
 MutableMethodInfo getDeclaredMethod(String name, String... parameters)
          Get the declared method Note: the parameters will be loaded with the classloader defined in TypeInfoFactory.
 MutableMethodInfo getDeclaredMethod(String name, TypeInfo... parameters)
          Get the declared method
 MutableMethodInfo[] getDeclaredMethods()
          Get the declared methods
 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
 byte[] toByteCode()
          Converts the class to a Class file.
 
Methods inherited from interface org.jboss.reflect.spi.ClassInfo
getActualTypeArguments, getComponentType, getGenericInterfaces, getGenericSuperclass, getInterfaces, getKeyType, getName, getOwnerType, getPackage, getRawType, getSuperclass, getTypeVariable, getValueType, isInterface
 
Methods inherited from interface org.jboss.reflect.spi.AnnotatedInfo
getAnnotation, getAnnotations, getUnderlyingAnnotation, getUnderlyingAnnotations, isAnnotationPresent, isAnnotationPresent
 
Methods inherited from interface org.jboss.util.JBossInterface
clone, toShortString, toShortString
 
Methods inherited from interface org.jboss.reflect.spi.ModifierInfo
getModifiers, isPublic, isStatic, isVolatile
 
Methods inherited from interface org.jboss.reflect.spi.TypeInfo
convertValue, convertValue, convertValue, getArrayType, getAttachment, getAttachment, getClassLoader, getSimpleName, getType, getTypeInfoFactory, isAnnotation, isArray, isAssignableFrom, isCollection, isEnum, isInstance, isMap, isPrimitive, newArrayInstance, setAttachment
 

Method Detail

getDeclaredMethod

MutableMethodInfo getDeclaredMethod(String name)
Get the declared method without parameters.

Parameters:
name - the method name
Returns:
the method info

getDeclaredMethod

MutableMethodInfo getDeclaredMethod(String name,
                                    TypeInfo... parameters)
Get the declared method

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

getDeclaredMethod

MutableMethodInfo getDeclaredMethod(String name,
                                    String... parameters)
                                    throws ClassNotFoundException
Get the declared method Note: the parameters will be loaded with the classloader defined in TypeInfoFactory.

Parameters:
name - the method name
parameters - the parameters
Returns:
the method info
Throws:
ClassNotFoundException

getDeclaredMethods

MutableMethodInfo[] getDeclaredMethods()
Get the declared methods

Specified by:
getDeclaredMethods in interface ClassInfo
Returns:
the methods

getDeclaredConstructors

MutableConstructorInfo[] getDeclaredConstructors()
Get the declared constructors

Specified by:
getDeclaredConstructors in interface ClassInfo
Returns:
the constructors

getDeclaredConstructor

MutableConstructorInfo getDeclaredConstructor()
Gets the default constructor (parameterless)

Returns:
the constructor

getDeclaredConstructor

MutableConstructorInfo getDeclaredConstructor(TypeInfo... parameters)
Get a declared constructor

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

getDeclaredConstructor

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

Parameters:
parameters - the parameters
Returns:
the constructor
Throws:
ClassNotFoundException

getDeclaredField

MutableFieldInfo getDeclaredField(String name)
Get the declared field

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

getDeclaredFields

MutableFieldInfo[] getDeclaredFields()
Get the declared fields

Specified by:
getDeclaredFields in interface ClassInfo
Returns:
the fields

createMutableMethod

MutableMethodInfo createMutableMethod(Body body)
Compiles the code included in Body and returns a MutableMethodInfo representation of it. The Body must include the whole declaration of the method.

Parameters:
body - contains the entire declaration of the method, including its signature
Returns:
the created method

createMutableMethod

MutableMethodInfo createMutableMethod(int modifiers,
                                      String returnType,
                                      String name,
                                      String[] parameters,
                                      String[] exceptions)
Compiles an empty method with the signature given by the parameters.

Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
name - 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

MutableMethodInfo createMutableMethod(int modifiers,
                                      ClassInfo returnType,
                                      String name,
                                      ClassInfo[] parameters,
                                      ClassInfo[] exceptions)
Compiles an empty method with the signature given by the parameters.

Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
name - 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

MutableMethodInfo createMutableMethod(int modifiers,
                                      String returnType,
                                      String name,
                                      Body body,
                                      String[] parameters,
                                      String[] exceptions)
Compiles a method with the signature and body given by the parameters. Note that the source code of the body must be surrounded by {}.

Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
name - 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

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

Parameters:
modifiers - the modifiers of the method to be created
returnType - the return type of the method to be created
name - 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

createMutableConstructor

MutableConstructorInfo createMutableConstructor(Body body)
Compiles the code included in the Body parameter and returns a MutableConstructorInfo representation of it. The Body must include the whole declaration. The

Parameters:
body - contains the code of the constructor to be created
Returns:
the created constructor

createMutableConstructor

MutableConstructorInfo createMutableConstructor(int modifiers,
                                                String[] parameters,
                                                String[] exceptions)
Creates an empty constructor with parameters given.

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

MutableConstructorInfo createMutableConstructor(int modifiers,
                                                ClassInfo[] parameters,
                                                ClassInfo[] exceptions)
Creates an empty constructor with the parameters given.

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

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

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

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

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

MutableFieldInfo createMutableField(int modifiers,
                                    String type,
                                    String name)
Creates a field connected to this class with the parameters given.

Parameters:
modifiers - the modifiers of the field to be created
type - the type of the field to be created
name - the name of the field to be created
Returns:
the created field

createMutableField

MutableFieldInfo createMutableField(int modifiers,
                                    ClassInfo type,
                                    String name)
Creates a field connected to this class with the parameters given.

Parameters:
modifiers - the modifiers of the field to be created
type - the type of the field to be created
name - the name of the field to be created
Returns:
the created field

addMethod

void addMethod(MutableMethodInfo mmi)
Add a method

Parameters:
mmi -

removeMethod

void removeMethod(MutableMethodInfo mmi)
Remove the specified method from this class

Parameters:
mmi -

addConstructor

void addConstructor(MutableConstructorInfo mci)
Add a constructor

Parameters:
mci -

removeConstructor

void removeConstructor(MutableConstructorInfo mci)
Remove the specified constructor from this class

Parameters:
mci -

addField

void addField(MutableFieldInfo mfi)
Add a field

Parameters:
mfi -

removeField

void removeField(MutableFieldInfo mfi)
Remove a field

Parameters:
mfi -

toByteCode

byte[] toByteCode()
Converts the class to a Class file. After this method is called, no modifications to the class are allowed.

Returns:
this class in bytecodes

JBoss Reflection 2.2.1.SP1

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