Package | Description |
---|---|
javassist |
The Javassist Core API.
|
javassist.bytecode |
Bytecode-level API.
|
javassist.bytecode.analysis |
Bytecode Analysis API.
|
javassist.bytecode.annotation |
Bytecode-level Annotations API.
|
javassist.bytecode.stackmap | |
javassist.compiler | |
javassist.convert | |
javassist.expr |
This package contains the classes for modifying a method body.
|
javassist.scopedpool |
A custom class pool for several JBoss products.
|
javassist.tools.reflect |
Runtime Behavioral Reflection.
|
javassist.tools.rmi |
Sample implementation of remote method invocation.
|
javassist.tools.web |
Simple web server for running sample code.
|
Modifier and Type | Method and Description |
---|---|
static CtMethod |
CtNewMethod.abstractMethod(CtClass returnType,
java.lang.String mname,
CtClass[] parameters,
CtClass[] exceptions,
CtClass declaring)
Creates a public abstract method.
|
void |
Loader.addTranslator(ClassPool cp,
Translator t)
Adds a translator, which is called whenever a class is loaded.
|
ClassPath |
ClassPool.appendClassPath(java.lang.String pathname)
Appends a directory or a jar (or zip) file to the end of the
search path.
|
ClassPath |
ClassPoolTail.appendClassPath(java.lang.String pathname) |
void |
ClassPool.appendPathList(java.lang.String pathlist)
Appends directories and jar files for search.
|
static CtField.Initializer |
CtField.Initializer.byNewArray(CtClass type,
int size)
Makes an initializer creating a new array.
|
private CtField |
CtClassType.checkGetField(CtField f,
java.lang.String name,
java.lang.String desc) |
private static CtMethod |
CtNewMethod.delegator0(CtMethod delegate,
CtClass declaring) |
CtClass |
ClassPool.get(java.lang.String classname)
Reads a class file from the source and returns a reference
to the
CtClass
object representing that class file. |
CtClass[] |
ClassPool.get(java.lang.String[] classnames)
Reads class files from the source and returns an array of
CtClass
objects representing those class files. |
protected CtClass |
ClassPool.get0(java.lang.String classname,
boolean useCache) |
CtClass |
ClassPool.getAndRename(java.lang.String orgName,
java.lang.String newName)
Reads a class file and constructs a
CtClass
object with a new name. |
CtClass |
CtClass.getComponentType()
If this object represents an array, this method returns the component
type of the array.
|
CtClass |
CtArray.getComponentType() |
CtConstructor |
CtClass.getConstructor(java.lang.String desc)
Returns the constructor with the given signature,
which is represented by a character string
called method descriptor.
|
CtConstructor |
CtClassType.getConstructor(java.lang.String desc) |
CtClass |
ClassPool.getCtClass(java.lang.String classname)
Returns a
CtClass object with the given name. |
CtClass[] |
CtClass.getDeclaredClasses()
Returns an array of nested classes declared in the class.
|
CtConstructor |
CtClass.getDeclaredConstructor(CtClass[] params)
Returns a constructor receiving the specified parameters.
|
CtField |
CtClass.getDeclaredField(java.lang.String name)
Retrieves the field with the specified name among the fields
declared in the class.
|
CtField |
CtClassType.getDeclaredField(java.lang.String name) |
CtField |
CtClass.getDeclaredField(java.lang.String name,
java.lang.String desc)
Retrieves the field with the specified name and type among the fields
declared in the class.
|
CtField |
CtClassType.getDeclaredField(java.lang.String name,
java.lang.String desc) |
CtMethod |
CtClass.getDeclaredMethod(java.lang.String name)
Retrieves the method with the specified name among the methods
declared in the class.
|
CtMethod |
CtClassType.getDeclaredMethod(java.lang.String name) |
CtMethod |
CtClass.getDeclaredMethod(java.lang.String name,
CtClass[] params)
Retrieves the method with the specified name and parameter types
among the methods declared in the class.
|
CtMethod |
CtClassType.getDeclaredMethod(java.lang.String name,
CtClass[] params) |
CtClass |
CtClass.getDeclaringClass()
If this class is a member class or interface of another class,
then the class enclosing this class is returned.
|
CtClass |
CtClassType.getDeclaringClass() |
CtMethod |
CtClass.getEnclosingMethod()
Returns the immediately enclosing method of this class.
|
CtMethod |
CtClassType.getEnclosingMethod() |
CtClass[] |
CtBehavior.getExceptionTypes()
Obtains exceptions that this method/constructor may throw.
|
CtField |
CtClass.getField(java.lang.String name)
Returns the field with the specified name.
|
CtField |
CtClass.getField(java.lang.String name,
java.lang.String desc)
Returns the field with the specified name and type.
|
CtField |
CtClassType.getField(java.lang.String name,
java.lang.String desc) |
CtClass[] |
CtClass.getInterfaces()
Obtains the class objects representing the interfaces implemented
by the class or, if this object represents an interface, the interfaces
extended by that interface.
|
CtClass[] |
CtArray.getInterfaces() |
CtClass[] |
CtClassType.getInterfaces() |
CtMethod |
CtClass.getMethod(java.lang.String name,
java.lang.String desc)
Returns the method with the given name and signature.
|
CtMethod |
ClassPool.getMethod(java.lang.String classname,
java.lang.String methodname)
Reads a class file and obtains a compile-time method.
|
CtMethod |
CtArray.getMethod(java.lang.String name,
java.lang.String desc) |
CtMethod |
CtClassType.getMethod(java.lang.String name,
java.lang.String desc) |
CtClass[] |
CtClass.getNestedClasses()
Returns an array of nested classes declared in the class.
|
CtClass[] |
CtClassType.getNestedClasses() |
CtClass[] |
CtBehavior.getParameterTypes()
Obtains parameter types of this method/constructor.
|
CtClass |
CtMethod.getReturnType()
Obtains the type of the returned value.
|
(package private) CtClass |
CtBehavior.getReturnType0()
Obtains the type of the returned value.
|
CtClass |
CtClass.getSuperclass()
Obtains the class object representing the superclass of the
class.
|
CtClass |
CtArray.getSuperclass() |
CtClass |
CtClassType.getSuperclass() |
CtClass |
CtField.getType()
Returns the type of the field.
|
java.net.URL |
CtClass.getURL()
Returns the uniform resource locator (URL) of the class file.
|
java.net.URL |
CtClassType.getURL() |
void |
CtNewClass.inheritAllConstructors()
Adds constructors inhrited from the super class.
|
ClassPath |
ClassPool.insertClassPath(java.lang.String pathname)
Inserts a directory or a jar (or zip) file at the head of the
search path.
|
ClassPath |
ClassPoolTail.insertClassPath(java.lang.String pathname) |
private static boolean |
SerialVersionUID.isSerializable(CtClass clazz)
Does the class implement Serializable?
|
private int |
CtClassType.makeFieldInitializer(Bytecode code,
CtClass[] parameters) |
private static ClassPath |
ClassPoolTail.makePathObject(java.lang.String pathname) |
private void |
CtClassType.modifyClassConstructor(ClassFile cf) |
private void |
CtClassType.modifyConstructors(ClassFile cf) |
void |
Translator.onLoad(ClassPool pool,
java.lang.String classname)
Is invoked by a
Loader for notifying that
a class is loaded. |
(package private) java.io.InputStream |
ClassPool.openClassfile(java.lang.String classname) |
java.io.InputStream |
ClassPath.openClassfile(java.lang.String classname)
Opens a class file.
|
java.io.InputStream |
JarDirClassPath.openClassfile(java.lang.String classname) |
java.io.InputStream |
JarClassPath.openClassfile(java.lang.String classname) |
(package private) java.io.InputStream |
ClassPoolTail.openClassfile(java.lang.String classname)
Opens the class file for the class specified by
classname . |
void |
CtClass.removeConstructor(CtConstructor c)
Removes a constructor declared in this class.
|
void |
CtClassType.removeConstructor(CtConstructor m) |
void |
CtClass.removeField(CtField f)
Removes a field declared in this class.
|
void |
CtClassType.removeField(CtField f) |
void |
CtClass.removeMethod(CtMethod m)
Removes a method declared in this class.
|
void |
CtClassType.removeMethod(CtMethod m) |
void |
CodeConverter.replaceArrayAccess(CtClass calledClass,
CodeConverter.ArrayAccessReplacementMethodNames names)
Modify a method body, so that ALL accesses to an array are replaced with
calls to static methods within another class.
|
void |
CtBehavior.setExceptionTypes(CtClass[] types)
Sets exceptions that this method/constructor may throw.
|
static void |
SerialVersionUID.setSerialVersionUID(CtClass clazz)
Adds serialVersionUID if one does not already exist.
|
void |
Translator.start(ClassPool pool)
Is invoked by a
Loader for initialization
when the object is attached to the Loader object. |
boolean |
CtClass.subtypeOf(CtClass clazz)
Returns
true if this class extends or implements
clazz . |
boolean |
CtArray.subtypeOf(CtClass clazz) |
boolean |
CtClassType.subtypeOf(CtClass clazz) |
(package private) void |
ClassPool.writeClassfile(java.lang.String classname,
java.io.OutputStream out) |
(package private) void |
ClassPoolTail.writeClassfile(java.lang.String classname,
java.io.OutputStream out)
This method does not close the output stream.
|
void |
CtClass.writeFile()
Writes a class file represented by this
CtClass
object in the current directory. |
Constructor and Description |
---|
CannotCompileException(NotFoundException e)
Constructs a CannotCompileException with a
NotFoundException . |
Constructor and Description |
---|
JarClassPath(java.lang.String pathname) |
JarDirClassPath(java.lang.String dirName) |
Modifier and Type | Method and Description |
---|---|
static CtClass[] |
Descriptor.getParameterTypes(java.lang.String desc,
ClassPool cp)
Returns the
CtClass objects representing the parameter
types specified by the given descriptor. |
static CtClass |
Descriptor.getReturnType(java.lang.String desc,
ClassPool cp)
Returns the
CtClass object representing the return
type specified by the given descriptor. |
private static int |
Descriptor.toCtClass(ClassPool cp,
java.lang.String desc,
int i,
CtClass[] args,
int n) |
static CtClass |
Descriptor.toCtClass(java.lang.String desc,
ClassPool cp)
Returns a
CtClass object representing the type
specified by the given descriptor. |
Modifier and Type | Method and Description |
---|---|
private static CtClass |
Type.findCommonSuperClass(CtClass one,
CtClass two) |
private Type |
Type.mergeClasses(Type type) |
Modifier and Type | Method and Description |
---|---|
static MemberValue |
Annotation.createMemberValue(ConstPool cp,
CtClass type)
Makes an instance of
MemberValue . |
Constructor and Description |
---|
Annotation(ConstPool cp,
CtClass clazz)
Constructs an annotation that can be accessed through the interface
represented by
clazz . |
Modifier and Type | Method and Description |
---|---|
static CtClass |
TypeData.commonSuperClass(CtClass one,
CtClass two)
Finds the most specific common super class of the given classes.
|
static CtClass |
TypeData.commonSuperClassEx(CtClass one,
CtClass two)
Finds the most specific common super class of the given classes
by considering array types.
|
int |
TypeData.dfs(java.util.ArrayList order,
int index,
ClassPool cp) |
int |
TypeData.TypeVar.dfs(java.util.ArrayList preOrder,
int index,
ClassPool cp) |
int |
TypeData.ArrayType.dfs(java.util.ArrayList order,
int index,
ClassPool cp) |
int |
TypeData.ArrayElement.dfs(java.util.ArrayList order,
int index,
ClassPool cp) |
private CtClass |
TypeData.TypeVar.fixByUppers(java.util.ArrayList users,
ClassPool cp,
java.util.HashSet visited,
CtClass type) |
private void |
TypeData.TypeVar.fixTypes(java.util.ArrayList scc,
ClassPool cp) |
private void |
MapMaker.fixTypes(byte[] code,
TypedBlock[] blocks) |
private java.lang.String |
TypeData.TypeVar.fixTypes2(java.util.ArrayList scc,
java.util.HashSet lowersSet,
ClassPool cp) |
private static boolean |
TypeData.TypeVar.isObjectArray(CtClass cc) |
Modifier and Type | Method and Description |
---|---|
private CtClass |
MemberResolver.lookupClass0(java.lang.String classname,
boolean notCheckInner) |
Constructor and Description |
---|
CompileError(NotFoundException e) |
Constructor and Description |
---|
TransformAccessArrayField(Transformer next,
java.lang.String methodClassname,
CodeConverter.ArrayAccessReplacementMethodNames names) |
TransformAfter(Transformer next,
CtMethod origMethod,
CtMethod afterMethod) |
TransformBefore(Transformer next,
CtMethod origMethod,
CtMethod beforeMethod) |
Modifier and Type | Method and Description |
---|---|
CtClass |
NewArray.getComponentType()
Returns the type of array components.
|
CtConstructor |
NewExpr.getConstructor()
Returns the constructor called for creating the object.
|
CtConstructor |
ConstructorCall.getConstructor()
Returns the called constructor.
|
private CtClass |
NewExpr.getCtClass()
Returns the class of the created object.
|
protected CtClass |
MethodCall.getCtClass()
Returns the class of the target object,
which the method is called on.
|
private CtClass |
FieldAccess.getCtClass()
Returns the class in which the field is declared.
|
CtField |
FieldAccess.getField()
Returns the field accessed by this expression.
|
CtMethod |
ConstructorCall.getMethod()
Always throws a
NotFoundException . |
CtMethod |
MethodCall.getMethod()
Returns the called method.
|
CtClass |
Cast.getType()
Returns the
CtClass object representing
the type specified by the cast. |
CtClass |
Instanceof.getType()
Returns the
CtClass object representing
the type name on the right hand side
of the instanceof operator. |
CtClass |
Handler.getType()
Returns the type handled by the catch clause.
|
private void |
NewArray.replace2(java.lang.String statement) |
Modifier and Type | Method and Description |
---|---|
CtClass |
ScopedClassPool.getLocally(java.lang.String classname)
Get any local copy of the class
|
Modifier and Type | Method and Description |
---|---|
private CtMethod |
Reflection.findOriginal(CtMethod m,
boolean dontSearch) |
boolean |
Reflection.makeReflective(java.lang.Class clazz,
java.lang.Class metaobject,
java.lang.Class metaclass)
Produces a reflective class.
|
boolean |
Reflection.makeReflective(CtClass clazz,
CtClass metaobject,
CtClass metaclass)
Produces a reflective class.
|
boolean |
Reflection.makeReflective(java.lang.String classname,
java.lang.String metaobject,
java.lang.String metaclass)
Produces a reflective class.
|
boolean |
Loader.makeReflective(java.lang.String clazz,
java.lang.String metaobject,
java.lang.String metaclass)
Produces a reflective class.
|
private boolean |
Reflection.modifyClassfile(CtClass clazz,
CtClass metaobject,
CtClass metaclass) |
void |
Reflection.onLoad(ClassPool pool,
java.lang.String classname)
Inserts hooks for intercepting accesses to the fields declared
in reflective classes.
|
private void |
Reflection.processFields(CtClass clazz) |
private void |
Reflection.processMethods(CtClass clazz,
boolean dontSearch) |
private void |
Reflection.processMethods0(int mod,
CtClass clazz,
CtMethod m,
int identifier,
boolean dontSearch) |
void |
Reflection.start(ClassPool pool)
Initializes the object.
|
Constructor and Description |
---|
Loader()
Constructs a new class loader.
|
Modifier and Type | Method and Description |
---|---|
private void |
StubGenerator.addMethods(CtClass proxy,
java.lang.reflect.Method[] ms) |
boolean |
StubGenerator.makeProxyClass(java.lang.Class clazz)
Makes a proxy class.
|
private void |
StubGenerator.modifySuperclass(CtClass orgclass)
Adds a default constructor to the super classes.
|
private CtClass |
StubGenerator.produceProxyClass(CtClass orgclass,
java.lang.Class orgRtClass) |
void |
StubGenerator.start(ClassPool pool)
Initializes the object.
|
private CtClass |
StubGenerator.toCtClass(java.lang.Class rtclass) |
private CtClass[] |
StubGenerator.toCtClass(java.lang.Class[] rtclasses) |
Constructor and Description |
---|
AppletServer(ClassPool loader,
StubGenerator gen,
int port) |
AppletServer(int port)
Constructs a web server.
|
AppletServer(int port,
ClassPool src)
Constructs a web server.
|
AppletServer(java.lang.String port)
Constructs a web server.
|
Modifier and Type | Method and Description |
---|---|
void |
Webserver.addTranslator(ClassPool cp,
Translator t)
Adds a translator, which is called whenever a client requests
a class file.
|