Uses of Class
javassist.CtClass
Packages that use CtClass
Package
Description
The Javassist Core API.
Bytecode-level API.
Bytecode Analysis API.
Bytecode-level Annotations API.
This package contains the classes for modifying a method body.
Runtime Behavioral Reflection.
Utility classes.
-
Uses of CtClass in javassist
Modifier and TypeClassDescriptionfinal classAn instance ofCtPrimitiveTyperepresents a primitive type.Modifier and TypeFieldDescriptionstatic CtClassCtClass.booleanTypeTheCtClassobject representing thebooleantype.static CtClassCtClass.byteTypeTheCtClassobject representing thebytetype.static CtClassCtClass.charTypeTheCtClassobject representing thechartype.static CtClassCtClass.doubleTypeTheCtClassobject representing thedoubletype.static CtClassCtClass.floatTypeTheCtClassobject representing thefloattype.static CtClassCtClass.intTypeTheCtClassobject representing theinttype.static CtClassCtClass.longTypeTheCtClassobject representing thelongtype.static CtClassCtClass.shortTypeTheCtClassobject representing theshorttype.static CtClassCtClass.voidTypeTheCtClassobject representing thevoidtype.Modifier and TypeMethodDescriptionReads a class file from the source and returns a reference to theCtClassobject representing that class file.CtClass[]Reads class files from the source and returns an array ofCtClassobjects representing those class files.ClassPool.getAndRename(String orgName, String newName) Reads a class file and constructs aCtClassobject with a new name.CtClass.getComponentType()If this object represents an array, this method returns the component type of the array.ClassPool.getCtClass(String classname) Returns aCtClassobject with the given name.CtClass[]CtClass.getDeclaredClasses()Returns an array of nested classes declared in the class.CtClass.getDeclaringClass()If this class is a member class or interface of another class, then the class enclosing this class is returned.CtField.getDeclaringClass()Returns the class declaring the field.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.Reads a class file from the source and returns a reference to theCtClassobject representing that class file.CtClass[]CtBehavior.getParameterTypes()Obtains parameter types of this method/constructor.CtMethod.getReturnType()Obtains the type of the returned value.CtClass.getSuperclass()Obtains the class object representing the superclass of the class.CtField.getType()Returns the type of the field.ClassPool.makeAnnotation(String name) Creates a new annotation.ClassPool.makeClass(InputStream classfile) Creates a new class (or interface) from the given class file.ClassPool.makeClass(InputStream classfile, boolean ifNotFrozen) Creates a new class (or interface) from the given class file.Creates a new public class.Creates a new public class.Creates a new class (or interface) from the given class file.Creates a new class (or interface) from the given class file.ClassPool.makeClassIfNew(InputStream classfile) Creates a new class (or interface) from the given class file.ClassPool.makeInterface(String name) Creates a new public interface.ClassPool.makeInterface(String name, CtClass superclass) Creates a new public interface.CtClass.makeNestedClass(String name, boolean isStatic) Makes a new public nested class.Modifier and TypeMethodDescriptionstatic CtMethodCtNewMethod.abstractMethod(CtClass returnType, String mname, CtClass[] parameters, CtClass[] exceptions, CtClass declaring) Creates a public abstract method.voidAdds a catch clause that handles an exception thrown in the body.voidAdds a catch clause that handles an exception thrown in the body.voidCtClass.addInterface(CtClass anInterface) Adds an interface.voidCtBehavior.addLocalVariable(String name, CtClass type) Declares a new local variable.voidCtBehavior.addParameter(CtClass type) Appends a new parameter, which becomes the last parameter.static CtField.InitializerMakes an initializer calling a static method.static CtField.InitializerMakes an initializer calling a static method.static CtField.InitializerCtField.Initializer.byCallWithParams(CtClass methodClass, String methodName) Makes an initializer calling a static method.static CtField.InitializerCtField.Initializer.byCallWithParams(CtClass methodClass, String methodName, String[] stringParams) Makes an initializer calling a static method.static CtField.InitializerMakes an initializer creating a new object.static CtField.InitializerMakes an initializer creating a new object.static CtField.InitializerCtField.Initializer.byNewArray(CtClass type, int size) Makes an initializer creating a new array.static CtField.InitializerCtField.Initializer.byNewArray(CtClass type, int[] sizes) Makes an initializer creating a new multi-dimensional array.static CtField.InitializerCtField.Initializer.byNewWithParams(CtClass objectType) Makes an initializer creating a new object.static CtField.InitializerCtField.Initializer.byNewWithParams(CtClass objectType, String[] stringParams) Makes an initializer creating a new object.static longSerialVersionUID.calculateDefault(CtClass clazz) Calculate default value.static CtConstructorCtNewConstructor.copy(CtConstructor c, CtClass declaring, ClassMap map) Creates a copy of a constructor.static CtMethodCreates a copy of a method with a new name.static CtMethodCreates a copy of a method.static CtConstructorCtNewConstructor.defaultConstructor(CtClass declaring) Creates a default (public) constructor.static CtMethodCreates a method forwarding to a delegate in a super class.voidPrevents a mapping from the specified class name to another name.CtClass.getDeclaredConstructor(CtClass[] params) Returns a constructor receiving the specified parameters.CtClass.getDeclaredMethod(String name, CtClass[] params) Retrieves the method with the specified name and parameter types among the methods declared in the class.voidCtBehavior.insertParameter(CtClass type) Inserts a new parameter, which becomes the first parameter.Class<?>Loader.Simple.invokeDefineClass(CtClass cc) Invokes the protecteddefineClass()inClassLoader.static CtFieldCompiles the given source code and creates a field.static CtMethodCompiles the given source code and creates a method.static CtMethodCtMethod.make(MethodInfo minfo, CtClass declaring) Creates a method from aMethodInfoobject.static CtConstructorCompiles the given source code and creates a constructor.static CtConstructorCtNewConstructor.make(CtClass[] parameters, CtClass[] exceptions, int howto, CtMethod body, CtMethod.ConstParameter cparam, CtClass declaring) Creates a public constructor.static CtConstructorCreates a public constructor.static CtConstructorCreates a public constructor that only calls a constructor in the super class.static CtMethodCtNewMethod.make(int modifiers, CtClass returnType, String mname, CtClass[] parameters, CtClass[] exceptions, String body, CtClass declaring) Creates a method.static CtMethodCompiles the given source code and creates a method.static CtMethodCompiles the given source code and creates a method.static CtMethodCtNewMethod.make(CtClass returnType, String mname, CtClass[] parameters, CtClass[] exceptions, String body, CtClass declaring) Creates a public (non-static) method.Creates a new public class.ClassPool.makeInterface(String name, CtClass superclass) Creates a new public interface.voidMaps a class name to another name in this hashtable.voidCodeConverter.redirectFieldAccess(CtField field, CtClass newClass, String newFieldname) Modify a method body so that field read/write expressions access a different field from the original one.voidCodeConverter.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.voidCodeConverter.replaceFieldRead(CtField field, CtClass calledClass, String calledMethod) Modify a method body so that an expression reading the specified field is replaced with a call to the specified static method.voidCodeConverter.replaceFieldWrite(CtField field, CtClass calledClass, String calledMethod) Modify a method body so that an expression writing the specified field is replaced with a call to the specified static method.voidCodeConverter.replaceNew(CtClass oldClass, CtClass newClass) Modify a method body so that instantiation of the class specified byoldClassis replaced with instantiation of another classnewClass.voidCodeConverter.replaceNew(CtClass newClass, CtClass calledClass, String calledMethod) Modify a method body so that instantiation of the specified class is replaced with a call to the specified static method.voidCtBehavior.setExceptionTypes(CtClass[] types) Sets exceptions that this method/constructor may throw.voidCtClass.setInterfaces(CtClass[] list) Sets implemented interfaces.static voidSerialVersionUID.setSerialVersionUID(CtClass clazz) Adds serialVersionUID if one does not already exist.voidCtClass.setSuperclass(CtClass clazz) Changes a super class unless this object represents an interface.voidSets the type of the field.static CtConstructorCreates a public constructor that only calls a constructor in the super class.booleanCtClass.subclassOf(CtClass superclass) Determines whether the class directly or indirectly extends the given class.booleanReturnstrueif this class extends or implementsclazz.Converts the given class to ajava.lang.Classobject.Class<?>Converts the class to ajava.lang.Classobject.ClassPool.toClass(CtClass ct, Class<?> neighbor, ClassLoader loader, ProtectionDomain domain) Converts the class to ajava.lang.Classobject.ClassPool.toClass(CtClass ct, ClassLoader loader) Deprecated.ClassPool.toClass(CtClass ct, ClassLoader loader, ProtectionDomain domain) Deprecated.Class<?>ClassPool.toClass(CtClass ct, MethodHandles.Lookup lookup) Converts the class to ajava.lang.Classobject.Makes a copy of this constructor and converts it into a method.Makes a copy of this constructor and converts it into a method.booleanCtMember.visibleFrom(CtClass clazz) Returns true if this member is accessible from the given class.static CtMethodCtNewMethod.wrapped(CtClass returnType, String mname, CtClass[] parameterTypes, CtClass[] exceptionTypes, CtMethod body, CtMethod.ConstParameter constParam, CtClass declaring) Creates a wrapped method.ModifierConstructorDescriptionCtConstructor(CtClass[] parameters, CtClass declaring) Creates a constructor with no constructor body.CtConstructor(CtConstructor src, CtClass declaring, ClassMap map) Creates a copy of aCtConstructorobject.Creates aCtFieldobject.Creates a copy of the given field.Creates a public abstract method.Creates a copy of aCtMethodobject. -
Uses of CtClass in javassist.bytecode
Fields in javassist.bytecode declared as CtClassModifier and TypeFieldDescriptionstatic final CtClassBytecode.THISRepresents theCtClassfile using the constant pool table given to thisBytecodeobject.static final CtClassConstPool.THISRepresents the class using this constant pool table.Methods in javassist.bytecode that return CtClassModifier and TypeMethodDescriptionSignatureAttribute.BaseType.getCtlass()Returns theCtClassrepresenting this primitive type.static CtClass[]Descriptor.getParameterTypes(String desc, ClassPool cp) Returns theCtClassobjects representing the parameter types specified by the given descriptor.static CtClassDescriptor.getReturnType(String desc, ClassPool cp) Returns theCtClassobject representing the return type specified by the given descriptor.static CtClassReturns aCtClassobject representing the type specified by the given descriptor.Methods in javassist.bytecode with parameters of type CtClassModifier and TypeMethodDescriptionvoidBytecode.addAnewarray(CtClass clazz, int length) Appends ICONST and ANEWARRAY.voidBytecode.addCheckcast(CtClass c) Appends CHECKCAST.intConstPool.addClassInfo(CtClass c) Adds a newCONSTANT_Class_infostructure.voidBytecode.addConstZero(CtClass type) Appends an instruction for pushing zero or null on the stack.voidBytecode.addExceptionHandler(int start, int end, int handler, CtClass type) Adds a new entry ofexception_table.voidBytecode.addGetfield(CtClass c, String name, String type) Appends GETFIELD.voidBytecode.addGetstatic(CtClass c, String name, String type) Appends GETSTATIC.voidBytecode.addInvokeinterface(CtClass clazz, String name, String desc, int count) Appends INVOKEINTERFACE.voidBytecode.addInvokeinterface(CtClass clazz, String name, CtClass returnType, CtClass[] paramTypes, int count) Appends INVOKEINTERFACE.voidBytecode.addInvokespecial(CtClass clazz, String name, String desc) Appends INVOKESPECIAL.voidBytecode.addInvokespecial(CtClass clazz, String name, CtClass returnType, CtClass[] paramTypes) Appends INVOKESPECIAL.voidBytecode.addInvokestatic(CtClass clazz, String name, String desc) Appends INVOKESTATIC.voidBytecode.addInvokestatic(CtClass clazz, String name, CtClass returnType, CtClass[] paramTypes) Appends INVOKESTATIC.voidBytecode.addInvokevirtual(CtClass clazz, String name, String desc) Appends INVOKEVIRTUAL.voidBytecode.addInvokevirtual(CtClass clazz, String name, CtClass returnType, CtClass[] paramTypes) Appends INVOKEVIRTUAL.intAppends an instruction for loading a value from the local variable at the indexn.intBytecode.addLoadParameters(CtClass[] params, int offset) Appends instructions for loading all the parameters onto the operand stack.intBytecode.addMultiNewarray(CtClass clazz, int dim) Appends MULTINEWARRAY.intBytecode.addMultiNewarray(CtClass clazz, int[] dimensions) Appends MULTINEWARRAY.voidAppends NEW.voidBytecode.addPutfield(CtClass c, String name, String desc) Appends PUTFIELD.voidBytecode.addPutstatic(CtClass c, String name, String desc) Appends PUTSTATIC.voidAppends ARETURN, IRETURN, .., or RETURN.intAppends an instruction for storing a value into the local variable at the indexn.static StringDescriptor.appendParameter(CtClass type, String descriptor) Appends a parameter type to the parameter list represented by the given descriptor.static StringDescriptor.insertParameter(CtClass type, String descriptor) Inserts a parameter type at the beginning of the parameter list represented by the given descriptor.static StringReturns the descriptor representing the given type.static StringDescriptor.ofConstructor(CtClass[] paramTypes) Returns the descriptor representing a constructor receiving the given parameter types.static StringReturns the descriptor representing a method that receives the given parameter types and returns the given type.static StringDescriptor.ofParameters(CtClass[] paramTypes) Returns the descriptor representing a list of parameter types.voidBytecode.setMaxLocals(boolean isStatic, CtClass[] params, int locals) Setsmax_locals.static StringReturns the internal representation of the class name in the JVM. -
Uses of CtClass in javassist.bytecode.analysis
Methods in javassist.bytecode.analysis that return CtClassModifier and TypeMethodDescriptionMultiArrayType.getCtClass()MultiType.getCtClass()Gets the class that corresponds with this type.Type.getCtClass()Returns the class this type represents.Methods in javassist.bytecode.analysis with parameters of type CtClassModifier and TypeMethodDescriptionFrame[]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 TypeObtain the Type for a given class.voidPrints all the methods declared in the given class.static voidFramePrinter.print(CtClass clazz, PrintStream stream) Prints all the methods declared in the given class.Constructors in javassist.bytecode.analysis with parameters of type CtClassModifierConstructorDescriptionControlFlow(CtClass ctclazz, MethodInfo minfo) Constructs a control-flow analyzer.Constructor parameters in javassist.bytecode.analysis with type arguments of type CtClass -
Uses of CtClass in javassist.bytecode.annotation
Methods in javassist.bytecode.annotation with parameters of type CtClassModifier and TypeMethodDescriptionstatic MemberValueAnnotation.createMemberValue(ConstPool cp, CtClass type) Makes an instance ofMemberValue.Constructors in javassist.bytecode.annotation with parameters of type CtClassModifierConstructorDescriptionAnnotation(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 CtClassModifier and TypeMethodDescriptionNewArray.getComponentType()Returns the type of array components.Expr.getEnclosingClass()Returns the class that declares the method enclosing this expression.Cast.getType()Returns theCtClassobject representing the type specified by the cast.Handler.getType()Returns the type handled by the catch clause.Instanceof.getType()Returns theCtClassobject 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 CtClassModifier and TypeMethodDescriptionbooleanExprEditor.doit(CtClass clazz, MethodInfo minfo) Undocumented method. -
Uses of CtClass in javassist.tools.reflect
Methods in javassist.tools.reflect with parameters of type CtClassModifier and TypeMethodDescriptionbooleanReflection.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
ClassPool.toClass(CtClass,Class,ClassLoader,ProtectionDomain).