Uses of Class
javassist.CtClass
-
Packages that use CtClass 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.expr This package contains the classes for modifying a method body.javassist.tools.reflect Runtime Behavioral Reflection.javassist.util Utility classes. -
-
Uses of CtClass in javassist
Subclasses of CtClass in javassist Modifier and Type Class Description class
CtPrimitiveType
An instance ofCtPrimitiveType
represents a primitive type.Fields in javassist declared as CtClass Modifier and Type Field Description static CtClass
CtClass. booleanType
TheCtClass
object representing theboolean
type.static CtClass
CtClass. byteType
TheCtClass
object representing thebyte
type.static CtClass
CtClass. charType
TheCtClass
object representing thechar
type.static CtClass
CtClass. doubleType
TheCtClass
object representing thedouble
type.static CtClass
CtClass. floatType
TheCtClass
object representing thefloat
type.static CtClass
CtClass. intType
TheCtClass
object representing theint
type.static CtClass
CtClass. longType
TheCtClass
object representing thelong
type.static CtClass
CtClass. shortType
TheCtClass
object representing theshort
type.static CtClass
CtClass. voidType
TheCtClass
object representing thevoid
type.Methods in javassist that return CtClass Modifier and Type Method Description CtClass
ClassPool. get(java.lang.String classname)
Reads a class file from the source and returns a reference to theCtClass
object representing that class file.CtClass[]
ClassPool. get(java.lang.String[] classnames)
Reads class files from the source and returns an array ofCtClass
objects representing those class files.CtClass
ClassPool. getAndRename(java.lang.String orgName, java.lang.String newName)
Reads a class file and constructs aCtClass
object with a new name.CtClass
CtClass. getComponentType()
If this object represents an array, this method returns the component type of the array.CtClass
ClassPool. getCtClass(java.lang.String classname)
Returns aCtClass
object with the given name.CtClass[]
CtClass. getDeclaredClasses()
Returns an array of nested classes 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.CtClass
CtField. getDeclaringClass()
Returns the class declaring the field.CtClass
CtMember. getDeclaringClass()
Returns the class that declares this member.CtClass[]
CtBehavior. getExceptionTypes()
Obtains exceptions that this method/constructor may throw.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[]
CtClass. getNestedClasses()
Returns an array of nested classes declared in the class.CtClass
ClassPool. getOrNull(java.lang.String classname)
Reads a class file from the source and returns a reference to theCtClass
object representing that class file.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.CtClass
ClassPool. makeAnnotation(java.lang.String name)
Creates a new annotation.CtClass
ClassPool. makeClass(java.io.InputStream classfile)
Creates a new class (or interface) from the given class file.CtClass
ClassPool. makeClass(java.io.InputStream classfile, boolean ifNotFrozen)
Creates a new class (or interface) from the given class file.CtClass
ClassPool. makeClass(java.lang.String classname)
Creates a new public class.CtClass
ClassPool. makeClass(java.lang.String classname, CtClass superclass)
Creates a new public class.CtClass
ClassPool. makeClass(ClassFile classfile)
Creates a new class (or interface) from the given class file.CtClass
ClassPool. makeClass(ClassFile classfile, boolean ifNotFrozen)
Creates a new class (or interface) from the given class file.CtClass
ClassPool. makeClassIfNew(java.io.InputStream classfile)
Creates a new class (or interface) from the given class file.CtClass
ClassPool. makeInterface(java.lang.String name)
Creates a new public interface.CtClass
ClassPool. makeInterface(java.lang.String name, CtClass superclass)
Creates a new public interface.CtClass
CtClass. makeNestedClass(java.lang.String name, boolean isStatic)
Makes a new public nested class.Methods in javassist with parameters of type CtClass Modifier and Type Method Description static CtMethod
CtNewMethod. abstractMethod(CtClass returnType, java.lang.String mname, CtClass[] parameters, CtClass[] exceptions, CtClass declaring)
Creates a public abstract method.void
CtBehavior. addCatch(java.lang.String src, CtClass exceptionType)
Adds a catch clause that handles an exception thrown in the body.void
CtBehavior. addCatch(java.lang.String src, CtClass exceptionType, java.lang.String exceptionName)
Adds a catch clause that handles an exception thrown in the body.void
CtClass. addInterface(CtClass anInterface)
Adds an interface.void
CtBehavior. addLocalVariable(java.lang.String name, CtClass type)
Declares a new local variable.void
CtBehavior. addParameter(CtClass type)
Appends a new parameter, which becomes the last parameter.static CtField.Initializer
CtField.Initializer. byCall(CtClass methodClass, java.lang.String methodName)
Makes an initializer calling a static method.static CtField.Initializer
CtField.Initializer. byCall(CtClass methodClass, java.lang.String methodName, java.lang.String[] stringParams)
Makes an initializer calling a static method.static CtField.Initializer
CtField.Initializer. byCallWithParams(CtClass methodClass, java.lang.String methodName)
Makes an initializer calling a static method.static CtField.Initializer
CtField.Initializer. byCallWithParams(CtClass methodClass, java.lang.String methodName, java.lang.String[] stringParams)
Makes an initializer calling a static method.static CtField.Initializer
CtField.Initializer. byNew(CtClass objectType)
Makes an initializer creating a new object.static CtField.Initializer
CtField.Initializer. byNew(CtClass objectType, java.lang.String[] stringParams)
Makes an initializer creating a new object.static CtField.Initializer
CtField.Initializer. byNewArray(CtClass type, int size)
Makes an initializer creating a new array.static CtField.Initializer
CtField.Initializer. byNewArray(CtClass type, int[] sizes)
Makes an initializer creating a new multi-dimensional array.static CtField.Initializer
CtField.Initializer. byNewWithParams(CtClass objectType)
Makes an initializer creating a new object.static CtField.Initializer
CtField.Initializer. byNewWithParams(CtClass objectType, java.lang.String[] stringParams)
Makes an initializer creating a new object.static long
SerialVersionUID. calculateDefault(CtClass clazz)
Calculate default value.static CtConstructor
CtNewConstructor. copy(CtConstructor c, CtClass declaring, ClassMap map)
Creates a copy of a constructor.static CtMethod
CtNewMethod. copy(CtMethod src, java.lang.String name, CtClass declaring, ClassMap map)
Creates a copy of a method with a new name.static CtMethod
CtNewMethod. copy(CtMethod src, CtClass declaring, ClassMap map)
Creates a copy of a method.static CtConstructor
CtNewConstructor. defaultConstructor(CtClass declaring)
Creates a default (public) constructor.static CtMethod
CtNewMethod. delegator(CtMethod delegate, CtClass declaring)
Creates a method forwarding to a delegate in a super class.void
ClassMap. fix(CtClass clazz)
Prevents a mapping from the specified class name to another name.CtConstructor
CtClass. getDeclaredConstructor(CtClass[] params)
Returns a constructor receiving the specified parameters.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.void
CtBehavior. insertParameter(CtClass type)
Inserts a new parameter, which becomes the first parameter.java.lang.Class<?>
Loader.Simple. invokeDefineClass(CtClass cc)
Invokes the protecteddefineClass()
inClassLoader
.static CtField
CtField. make(java.lang.String src, CtClass declaring)
Compiles the given source code and creates a field.static CtMethod
CtMethod. make(java.lang.String src, CtClass declaring)
Compiles the given source code and creates a method.static CtMethod
CtMethod. make(MethodInfo minfo, CtClass declaring)
Creates a method from aMethodInfo
object.static CtConstructor
CtNewConstructor. make(java.lang.String src, CtClass declaring)
Compiles the given source code and creates a constructor.static CtConstructor
CtNewConstructor. make(CtClass[] parameters, CtClass[] exceptions, int howto, CtMethod body, CtMethod.ConstParameter cparam, CtClass declaring)
Creates a public constructor.static CtConstructor
CtNewConstructor. make(CtClass[] parameters, CtClass[] exceptions, java.lang.String body, CtClass declaring)
Creates a public constructor.static CtConstructor
CtNewConstructor. make(CtClass[] parameters, CtClass[] exceptions, CtClass declaring)
Creates a public constructor that only calls a constructor in the super class.static CtMethod
CtNewMethod. make(int modifiers, CtClass returnType, java.lang.String mname, CtClass[] parameters, CtClass[] exceptions, java.lang.String body, CtClass declaring)
Creates a method.static CtMethod
CtNewMethod. make(java.lang.String src, CtClass declaring)
Compiles the given source code and creates a method.static CtMethod
CtNewMethod. make(java.lang.String src, CtClass declaring, java.lang.String delegateObj, java.lang.String delegateMethod)
Compiles the given source code and creates a method.static CtMethod
CtNewMethod. make(CtClass returnType, java.lang.String mname, CtClass[] parameters, CtClass[] exceptions, java.lang.String body, CtClass declaring)
Creates a public (non-static) method.CtClass
ClassPool. makeClass(java.lang.String classname, CtClass superclass)
Creates a new public class.CtClass
ClassPool. makeInterface(java.lang.String name, CtClass superclass)
Creates a new public interface.void
ClassMap. put(CtClass oldname, CtClass newname)
Maps a class name to another name in this hashtable.void
CodeConverter. redirectFieldAccess(CtField field, CtClass newClass, java.lang.String newFieldname)
Modify a method body so that field read/write expressions access a different field from the original one.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
CodeConverter. replaceFieldRead(CtField field, CtClass calledClass, java.lang.String calledMethod)
Modify a method body so that an expression reading the specified field is replaced with a call to the specified static method.void
CodeConverter. replaceFieldWrite(CtField field, CtClass calledClass, java.lang.String calledMethod)
Modify a method body so that an expression writing the specified field is replaced with a call to the specified static method.void
CodeConverter. replaceNew(CtClass oldClass, CtClass newClass)
Modify a method body so that instantiation of the class specified byoldClass
is replaced with instantiation of another classnewClass
.void
CodeConverter. replaceNew(CtClass newClass, CtClass calledClass, java.lang.String calledMethod)
Modify a method body so that instantiation of the specified class is replaced with a call to the specified static method.void
CtBehavior. setExceptionTypes(CtClass[] types)
Sets exceptions that this method/constructor may throw.void
CtClass. setInterfaces(CtClass[] list)
Sets implemented interfaces.static void
SerialVersionUID. setSerialVersionUID(CtClass clazz)
Adds serialVersionUID if one does not already exist.void
CtClass. setSuperclass(CtClass clazz)
Changes a super class unless this object represents an interface.void
CtField. setType(CtClass clazz)
Sets the type of the field.static CtConstructor
CtNewConstructor. skeleton(CtClass[] parameters, CtClass[] exceptions, CtClass declaring)
Creates a public constructor that only calls a constructor in the super class.boolean
CtClass. subclassOf(CtClass superclass)
Determines whether the class directly or indirectly extends the given class.boolean
CtClass. subtypeOf(CtClass clazz)
Returnstrue
if this class extends or implementsclazz
.java.lang.Class
ClassPool. toClass(CtClass clazz)
Converts the given class to ajava.lang.Class
object.java.lang.Class<?>
ClassPool. toClass(CtClass ct, java.lang.Class<?> neighbor)
Converts the class to ajava.lang.Class
object.java.lang.Class
ClassPool. toClass(CtClass ct, java.lang.Class<?> neighbor, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)
Converts the class to ajava.lang.Class
object.java.lang.Class
ClassPool. toClass(CtClass ct, java.lang.ClassLoader loader)
Deprecated.java.lang.Class
ClassPool. toClass(CtClass ct, java.lang.ClassLoader loader, java.security.ProtectionDomain domain)
Deprecated.java.lang.Class<?>
ClassPool. toClass(CtClass ct, java.lang.invoke.MethodHandles.Lookup lookup)
Converts the class to ajava.lang.Class
object.CtMethod
CtConstructor. toMethod(java.lang.String name, CtClass declaring)
Makes a copy of this constructor and converts it into a method.CtMethod
CtConstructor. toMethod(java.lang.String name, CtClass declaring, ClassMap map)
Makes a copy of this constructor and converts it into a method.boolean
CtMember. visibleFrom(CtClass clazz)
Returns true if this member is accessible from the given class.static CtMethod
CtNewMethod. wrapped(CtClass returnType, java.lang.String mname, CtClass[] parameterTypes, CtClass[] exceptionTypes, CtMethod body, CtMethod.ConstParameter constParam, CtClass declaring)
Creates a wrapped method.Constructors in javassist with parameters of type CtClass Constructor Description CtConstructor(CtClass[] parameters, CtClass declaring)
Creates a constructor with no constructor body.CtConstructor(CtConstructor src, CtClass declaring, ClassMap map)
Creates a copy of aCtConstructor
object.CtField(CtClass type, java.lang.String name, CtClass declaring)
Creates aCtField
object.CtField(CtField src, CtClass declaring)
Creates a copy of the given field.CtMethod(CtClass returnType, java.lang.String mname, CtClass[] parameters, CtClass declaring)
Creates a public abstract method.CtMethod(CtMethod src, CtClass declaring, ClassMap map)
Creates a copy of aCtMethod
object. -
Uses of CtClass in javassist.bytecode
Fields in javassist.bytecode declared as CtClass Modifier and Type Field Description static CtClass
Bytecode. THIS
Represents theCtClass
file using the constant pool table given to thisBytecode
object.static CtClass
ConstPool. THIS
Represents the class using this constant pool table.Methods in javassist.bytecode that return CtClass Modifier and Type Method Description CtClass
SignatureAttribute.BaseType. getCtlass()
Returns theCtClass
representing this primitive type.static CtClass[]
Descriptor. getParameterTypes(java.lang.String desc, ClassPool cp)
Returns theCtClass
objects representing the parameter types specified by the given descriptor.static CtClass
Descriptor. getReturnType(java.lang.String desc, ClassPool cp)
Returns theCtClass
object representing the return type specified by the given descriptor.static CtClass
Descriptor. toCtClass(java.lang.String desc, ClassPool cp)
Returns aCtClass
object representing the type specified by the given descriptor.Methods in javassist.bytecode with parameters of type CtClass Modifier and Type Method Description void
Bytecode. addAnewarray(CtClass clazz, int length)
Appends ICONST and ANEWARRAY.void
Bytecode. addCheckcast(CtClass c)
Appends CHECKCAST.int
ConstPool. addClassInfo(CtClass c)
Adds a newCONSTANT_Class_info
structure.void
Bytecode. addConstZero(CtClass type)
Appends an instruction for pushing zero or null on the stack.void
Bytecode. addExceptionHandler(int start, int end, int handler, CtClass type)
Adds a new entry ofexception_table
.void
Bytecode. addGetfield(CtClass c, java.lang.String name, java.lang.String type)
Appends GETFIELD.void
Bytecode. addGetstatic(CtClass c, java.lang.String name, java.lang.String type)
Appends GETSTATIC.void
Bytecode. addInvokeinterface(CtClass clazz, java.lang.String name, java.lang.String desc, int count)
Appends INVOKEINTERFACE.void
Bytecode. addInvokeinterface(CtClass clazz, java.lang.String name, CtClass returnType, CtClass[] paramTypes, int count)
Appends INVOKEINTERFACE.void
Bytecode. addInvokespecial(CtClass clazz, java.lang.String name, java.lang.String desc)
Appends INVOKESPECIAL.void
Bytecode. addInvokespecial(CtClass clazz, java.lang.String name, CtClass returnType, CtClass[] paramTypes)
Appends INVOKESPECIAL.void
Bytecode. addInvokestatic(CtClass clazz, java.lang.String name, java.lang.String desc)
Appends INVOKESTATIC.void
Bytecode. addInvokestatic(CtClass clazz, java.lang.String name, CtClass returnType, CtClass[] paramTypes)
Appends INVOKESTATIC.void
Bytecode. addInvokevirtual(CtClass clazz, java.lang.String name, java.lang.String desc)
Appends INVOKEVIRTUAL.void
Bytecode. addInvokevirtual(CtClass clazz, java.lang.String name, CtClass returnType, CtClass[] paramTypes)
Appends INVOKEVIRTUAL.int
Bytecode. addLoad(int n, CtClass type)
Appends an instruction for loading a value from the local variable at the indexn
.int
Bytecode. addLoadParameters(CtClass[] params, int offset)
Appends instructions for loading all the parameters onto the operand stack.int
Bytecode. addMultiNewarray(CtClass clazz, int dim)
Appends MULTINEWARRAY.int
Bytecode. addMultiNewarray(CtClass clazz, int[] dimensions)
Appends MULTINEWARRAY.void
Bytecode. addNew(CtClass clazz)
Appends NEW.void
Bytecode. addPutfield(CtClass c, java.lang.String name, java.lang.String desc)
Appends PUTFIELD.void
Bytecode. addPutstatic(CtClass c, java.lang.String name, java.lang.String desc)
Appends PUTSTATIC.void
Bytecode. addReturn(CtClass type)
Appends ARETURN, IRETURN, .., or RETURN.int
Bytecode. addStore(int n, CtClass type)
Appends an instruction for storing a value into the local variable at the indexn
.static java.lang.String
Descriptor. appendParameter(CtClass type, java.lang.String descriptor)
Appends a parameter type to the parameter list represented by the given descriptor.static java.lang.String
Descriptor. insertParameter(CtClass type, java.lang.String descriptor)
Inserts a parameter type at the beginning of the parameter list represented by the given descriptor.static java.lang.String
Descriptor. of(CtClass type)
Returns the descriptor representing the given type.static java.lang.String
Descriptor. ofConstructor(CtClass[] paramTypes)
Returns the descriptor representing a constructor receiving the given parameter types.static java.lang.String
Descriptor. ofMethod(CtClass returnType, CtClass[] paramTypes)
Returns the descriptor representing a method that receives the given parameter types and returns the given type.static java.lang.String
Descriptor. ofParameters(CtClass[] paramTypes)
Returns the descriptor representing a list of parameter types.void
Bytecode. setMaxLocals(boolean isStatic, CtClass[] params, int locals)
Setsmax_locals
.static java.lang.String
Descriptor. toJvmName(CtClass clazz)
Returns the internal representation of the class name in the JVM. -
Uses of CtClass in javassist.bytecode.analysis
Methods in javassist.bytecode.analysis that return CtClass Modifier and Type Method Description CtClass
MultiArrayType. getCtClass()
CtClass
MultiType. getCtClass()
Gets the class that corresponds with this type.CtClass
Type. getCtClass()
Returns the class this type represents.Methods in javassist.bytecode.analysis with parameters of type CtClass Modifier and Type Method Description Frame[]
Analyzer. analyze(CtClass clazz, MethodInfo method)
Performs data-flow analysis on a method and returns an array, indexed by instruction position, containing the starting frame state of all reachable instructions.static Type
Type. get(CtClass clazz)
Obtain the Type for a given class.void
FramePrinter. print(CtClass clazz)
Prints all the methods declared in the given class.static void
FramePrinter. print(CtClass clazz, java.io.PrintStream stream)
Prints all the methods declared in the given class.Constructors in javassist.bytecode.analysis with parameters of type CtClass Constructor Description ControlFlow(CtClass ctclazz, MethodInfo minfo)
Constructs a control-flow analyzer.Constructor parameters in javassist.bytecode.analysis with type arguments of type CtClass Constructor Description MultiType(java.util.Map<java.lang.String,CtClass> interfaces)
MultiType(java.util.Map<java.lang.String,CtClass> interfaces, Type potentialClass)
-
Uses of CtClass in javassist.bytecode.annotation
Methods in javassist.bytecode.annotation with parameters of type CtClass Modifier and Type Method Description static MemberValue
Annotation. createMemberValue(ConstPool cp, CtClass type)
Makes an instance ofMemberValue
.Constructors in javassist.bytecode.annotation with parameters of type CtClass Constructor Description Annotation(ConstPool cp, CtClass clazz)
Constructs an annotation that can be accessed through the interface represented byclazz
. -
Uses of CtClass in javassist.expr
Methods in javassist.expr that return CtClass Modifier and Type Method Description CtClass
NewArray. getComponentType()
Returns the type of array components.CtClass
Expr. getEnclosingClass()
Returns the class that declares the method enclosing this expression.CtClass
Cast. getType()
Returns theCtClass
object representing the type specified by the cast.CtClass
Handler. getType()
Returns the type handled by the catch clause.CtClass
Instanceof. getType()
Returns theCtClass
object representing the type name on the right hand side of the instanceof operator.CtClass[]
Cast. mayThrow()
Returns the list of exceptions that the expression may throw.CtClass[]
Expr. mayThrow()
Returns the list of exceptions that the expression may throw.CtClass[]
FieldAccess. mayThrow()
Returns the list of exceptions that the expression may throw.CtClass[]
Handler. mayThrow()
Returns the list of exceptions that the catch clause may throw.CtClass[]
Instanceof. mayThrow()
Returns the list of exceptions that the expression may throw.CtClass[]
MethodCall. mayThrow()
Returns the list of exceptions that the expression may throw.CtClass[]
NewArray. mayThrow()
Returns the list of exceptions that the expression may throw.CtClass[]
NewExpr. mayThrow()
Returns the list of exceptions that the expression may throw.Methods in javassist.expr with parameters of type CtClass Modifier and Type Method Description boolean
ExprEditor. doit(CtClass clazz, MethodInfo minfo)
Undocumented method. -
Uses of CtClass in javassist.tools.reflect
Methods in javassist.tools.reflect with parameters of type CtClass Modifier and Type Method Description boolean
Reflection. makeReflective(CtClass clazz, CtClass metaobject, CtClass metaclass)
Produces a reflective class. -
Uses of CtClass in javassist.util
Methods in javassist.util with parameters of type CtClass Modifier and Type Method Description static void
HotSwapAgent. redefine(java.lang.Class<?>[] oldClasses, CtClass[] newClasses)
Redefines classes.static void
HotSwapAgent. redefine(java.lang.Class<?> oldClass, CtClass newClass)
Redefines a class.
-