Package | Description |
---|---|
javassist |
The Javassist Core API.
|
javassist.bytecode |
Bytecode-level 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.
|
javassist.util |
Utility classes.
|
Modifier and Type | Method | Description |
---|---|---|
static CtMethod |
CtNewMethod.abstractMethod(CtClass returnType,
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(String pathname) |
Appends a directory or a jar (or zip) file to the end of the
search path.
|
void |
ClassPool.appendPathList(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.
|
CtClass |
ClassPool.get(String classname) |
Reads a class file from the source and returns a reference
to the
CtClass
object representing that class file. |
CtClass[] |
ClassPool.get(String[] classnames) |
Reads class files from the source and returns an array of
CtClass
objects representing those class files. |
protected CtClass |
ClassPool.get0(String classname,
boolean useCache) |
|
CtClass |
ClassPool.getAndRename(String orgName,
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.
|
CtConstructor |
CtClass.getConstructor(String desc) |
Returns the constructor with the given signature,
which is represented by a character string
called method descriptor.
|
CtClass |
ClassPool.getCtClass(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(String name) |
Retrieves the field with the specified name among the fields
declared in the class.
|
CtField |
CtClass.getDeclaredField(String name,
String desc) |
Retrieves the field with the specified name and type among the fields
declared in the class.
|
CtMethod |
CtClass.getDeclaredMethod(String name) |
Retrieves the method with the specified name among the methods
declared in the class.
|
CtMethod |
CtClass.getDeclaredMethod(String name,
CtClass[] params) |
Retrieves the method with the specified name and parameter types
among the methods declared in the class.
|
CtMethod[] |
CtClass.getDeclaredMethods(String name) |
Retrieves methods with the specified name among the methods
declared in the class.
|
CtClass |
CtClass.getDeclaringClass() |
If this class is a member class or interface of another class,
then the class enclosing this class is returned.
|
CtBehavior |
CtClass.getEnclosingBehavior() |
Returns the immediately enclosing method of this class.
|
CtMethod |
CtClass.getEnclosingMethod() |
Deprecated.
The enclosing method might be a constructor.
|
CtClass[] |
CtBehavior.getExceptionTypes() |
Obtains exceptions that this method/constructor may throw.
|
CtField |
CtClass.getField(String name) |
Returns the field with the specified name.
|
CtField |
CtClass.getField(String name,
String desc) |
Returns the field with the specified name and type.
|
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.
|
CtMethod |
ClassPool.getMethod(String classname,
String methodname) |
Reads a class file and obtains a compile-time method.
|
CtMethod |
CtClass.getMethod(String name,
String desc) |
Returns the method with the given name and signature.
|
CtClass[] |
CtClass.getNestedClasses() |
Returns an array of nested classes declared in the class.
|
CtClass[] |
CtBehavior.getParameterTypes() |
Obtains parameter types of this method/constructor.
|
CtClass |
CtMethod.getReturnType() |
Obtains the type of the returned value.
|
CtClass |
CtClass.getSuperclass() |
Obtains the class object representing the superclass of the
class.
|
CtClass |
CtField.getType() |
Returns the type of the field.
|
URL |
CtClass.getURL() |
Returns the uniform resource locator (URL) of the class file.
|
ClassPath |
ClassPool.insertClassPath(String pathname) |
Inserts a directory or a jar (or zip) file at the head of the
search path.
|
void |
Translator.onLoad(ClassPool pool,
String classname) |
Is invoked by a
Loader for notifying that
a class is loaded. |
InputStream |
ClassClassPath.openClassfile(String classname) |
Obtains a class file by
getResourceAsStream() . |
InputStream |
ClassPath.openClassfile(String classname) |
Opens a class file.
|
InputStream |
LoaderClassPath.openClassfile(String classname) |
Obtains a class file from the class loader.
|
void |
CtClass.removeConstructor(CtConstructor c) |
Removes a constructor declared in this class.
|
void |
CtClass.removeField(CtField f) |
Removes a field declared in this class.
|
void |
CtClass.removeMethod(CtMethod m) |
Removes a method declared in this class.
|
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 . |
void |
CtClass.writeFile() |
Writes a class file represented by this
CtClass
object in the current directory. |
Constructor | Description |
---|---|
CannotCompileException(NotFoundException e) |
Constructs a CannotCompileException with a
NotFoundException . |
Modifier and Type | Method | Description |
---|---|---|
static CtClass[] |
Descriptor.getParameterTypes(String desc,
ClassPool cp) |
Returns the
CtClass objects representing the parameter
types specified by the given descriptor. |
static CtClass |
Descriptor.getReturnType(String desc,
ClassPool cp) |
Returns the
CtClass object representing the return
type specified by the given descriptor. |
static CtClass |
Descriptor.toCtClass(String desc,
ClassPool cp) |
Returns a
CtClass object representing the type
specified by the given descriptor. |
Modifier and Type | Method | Description |
---|---|---|
static MemberValue |
Annotation.createMemberValue(ConstPool cp,
CtClass type) |
Makes an instance of
MemberValue . |
Constructor | Description |
---|---|
Annotation(ConstPool cp,
CtClass clazz) |
Constructs an annotation that can be accessed through the interface
represented by
clazz . |
Modifier and Type | Method | 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.ArrayElement.dfs(List<TypeData> order,
int index,
ClassPool cp) |
|
int |
TypeData.ArrayType.dfs(List<TypeData> order,
int index,
ClassPool cp) |
|
int |
TypeData.dfs(List<TypeData> order,
int index,
ClassPool cp) |
Depth-first search by Tarjan's algorithm
|
int |
TypeData.TypeVar.dfs(List<TypeData> preOrder,
int index,
ClassPool cp) |
|
TypeData |
TypeData.ArrayElement.getArrayType(int dim) |
|
TypeData |
TypeData.ArrayType.getArrayType(int dim) |
|
TypeData |
TypeData.BasicType.getArrayType(int dim) |
|
TypeData |
TypeData.ClassName.getArrayType(int dim) |
|
abstract TypeData |
TypeData.getArrayType(int dim) |
|
TypeData |
TypeData.TypeVar.getArrayType(int dim) |
|
TypeData |
TypeData.UninitTypeVar.getArrayType(int dim) |
Constructor | Description |
---|---|
CompileError(NotFoundException e) |
Constructor | Description |
---|---|
TransformAccessArrayField(Transformer next,
String methodClassname,
CodeConverter.ArrayAccessReplacementMethodNames names) |
|
TransformAfter(Transformer next,
CtMethod origMethod,
CtMethod afterMethod) |
|
TransformBefore(Transformer next,
CtMethod origMethod,
CtMethod beforeMethod) |
Modifier and Type | Method | Description |
---|---|---|
CtClass |
NewArray.getComponentType() |
Returns the type of array components.
|
CtConstructor |
ConstructorCall.getConstructor() |
Returns the called constructor.
|
CtConstructor |
NewExpr.getConstructor() |
Returns the constructor called for creating the object.
|
protected CtClass |
MethodCall.getCtClass() |
Returns the class of the target object,
which the method is called on.
|
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 |
Handler.getType() |
Returns the type handled by the catch clause.
|
CtClass |
Instanceof.getType() |
Returns the
CtClass object representing
the type name on the right hand side
of the instanceof operator. |
Modifier and Type | Method | Description |
---|---|---|
CtClass |
ScopedClassPool.getLocally(String classname) |
Get any local copy of the class
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
Loader.makeReflective(String clazz,
String metaobject,
String metaclass) |
Produces a reflective class.
|
boolean |
Reflection.makeReflective(Class<?> clazz,
Class<?> metaobject,
Class<?> metaclass) |
Produces a reflective class.
|
boolean |
Reflection.makeReflective(String classname,
String metaobject,
String metaclass) |
Produces a reflective class.
|
boolean |
Reflection.makeReflective(CtClass clazz,
CtClass metaobject,
CtClass metaclass) |
Produces a reflective class.
|
void |
Reflection.onLoad(ClassPool pool,
String classname) |
Inserts hooks for intercepting accesses to the fields declared
in reflective classes.
|
void |
Reflection.start(ClassPool pool) |
Initializes the object.
|
Constructor | Description |
---|---|
Loader() |
Constructs a new class loader.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
StubGenerator.makeProxyClass(Class<?> clazz) |
Makes a proxy class.
|
void |
StubGenerator.start(ClassPool pool) |
Initializes the object.
|
Constructor | Description |
---|---|
AppletServer(int port) |
Constructs a web server.
|
AppletServer(int port,
ClassPool src) |
Constructs a web server.
|
AppletServer(String port) |
Constructs a web server.
|
Modifier and Type | Method | Description |
---|---|---|
void |
Webserver.addTranslator(ClassPool cp,
Translator t) |
Adds a translator, which is called whenever a client requests
a class file.
|
Modifier and Type | Method | Description |
---|---|---|
static File |
HotSwapAgent.createAgentJarFile(String fileName) |
Creates an agent file for using
HotSwapAgent . |
static void |
HotSwapAgent.redefine(Class<?>[] oldClasses,
CtClass[] newClasses) |
Redefines classes.
|
static void |
HotSwapAgent.redefine(Class<?> oldClass,
CtClass newClass) |
Redefines a class.
|
Copyright © 2018 Shigeru Chiba, www.javassist.org. All rights reserved.