Top Description Fields Constructors Methods
javassist

pack-priv Class CtClassType

Additional top-level class in compilation unit: FieldInitLink.

extends CtClass
Class Inheritance
Known Direct Subclasses
javassist.CtNewClass
Imports
java.io.BufferedInputStream, .ByteArrayInputStream, .ByteArrayOutputStream, .DataInputStream, .DataOutputStream, .IOException, .InputStream, java.lang.ref.Reference, .WeakReference, java.net.URL, java.util.ArrayList, .HashMap, .Hashtable, .List, .Map, .Set, javassist.bytecode.AccessFlag, .AnnotationsAttribute, .AttributeInfo, .BadBytecode, .Bytecode, .ClassFile, .CodeAttribute, .CodeIterator, .ConstPool, .ConstantAttribute, .Descriptor, .EnclosingMethodAttribute, .FieldInfo, .InnerClassesAttribute, .MethodInfo, .ParameterAnnotationsAttribute, .SignatureAttribute, javassist.bytecode.annotation.Annotation, javassist.compiler.AccessorMaker, .CompileError, .Javac, javassist.expr.ExprEditor

Class types.

Field Summary

Modifier and TypeField and Description
private AccessorMaker
pack-priv ClassFile
pack-priv ClassPool
private boolean
private FieldInitLink
pack-priv boolean
private static final int
private int
private Map<CtMethod, String>
private Reference<CtMember.Cache>
pack-priv byte[]
private int
pack-priv boolean
private boolean
pack-priv boolean
Inherited from javassist.CtClass:
booleanTypebyteTypecharTypedebugDumpdoubleTypefloatTypeintTypejavaLangObjectlongTypeprimitiveTypesqualifiedNameshortTypeversionvoidType

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public void
addField(CtField f, String
an expression for the initial value.
init
)

Overrides javassist.CtClass.addField.

Adds a field with an initial value.

public void
addField(CtField f, CtField.Initializer
specifies the initial value of the field.
init
)

Overrides javassist.CtClass.addField.

Adds a field with an initial value.

public void
addInterface(CtClass
the added interface.
anInterface
)

Overrides javassist.CtClass.addInterface.

Adds an interface.

public void
addMethod(CtMethod m)

Overrides javassist.CtClass.addMethod.

Adds a method.

private CtField
pack-priv void
private void
pack-priv void
compress()

Overrides javassist.CtClass.compress.

Invoked from ClassPool#compress().

public void
defrost()

Overrides javassist.CtClass.defrost.

Defrosts the class so that the class can be modified again.

private void
protected void
extendToString(StringBuilder buffer)

Overrides javassist.CtClass.extendToString.

Implemented in subclasses to add to the toString() result.

private void
exToString(StringBuilder buffer, String msg, CtMember head, CtMember tail)

public void
freeze()

Overrides javassist.CtClass.freeze.

Makes the class frozen.

public AccessorMaker
getAccessorMaker()

Overrides javassist.CtClass.getAccessorMaker.

Undocumented method.

public Object
getAnnotation(Class<?>
the annotation type.
clz
)

Overrides javassist.CtClass.getAnnotation.

Returns the annotation if the class has the specified annotation type.

public Object[]
getAnnotations()

Overrides javassist.CtClass.getAnnotations.

Returns the annotations associated with this class.

private Object[]
getAnnotations(boolean ignoreNotFound)

pack-priv static Object
public byte[]
getAttribute(String
attribute name
name
)

Overrides javassist.CtClass.getAttribute.

Obtains an attribute with the given name.

public Object[]
getAvailableAnnotations()

Overrides javassist.CtClass.getAvailableAnnotations.

Returns the annotations associated with this class.

public ClassFile
getClassFile2()

Overrides javassist.CtClass.getClassFile2.

Returns a class file for this class (read only).

public ClassFile
getClassFile3(boolean doCompress)

public CtConstructor
getClassInitializer()

Overrides javassist.CtClass.getClassInitializer.

Gets the class initializer (static constructor) declared in the class.

public ClassPool
getClassPool()

Overrides javassist.CtClass.getClassPool.

Returns a ClassPool for this class.

public CtConstructor
getConstructor(String
method descriptor
desc
)

Overrides javassist.CtClass.getConstructor.

Returns the constructor with the given signature, which is represented by a character string called method descriptor.

public CtConstructor[]
getConstructors()

Overrides javassist.CtClass.getConstructors.

Returns an array containing CtConstructor objects representing all the non-private constructors of the class.

public CtBehavior[]
getDeclaredBehaviors()

Overrides javassist.CtClass.getDeclaredBehaviors.

Gets all the constructors and methods declared in the class.

public CtConstructor[]
getDeclaredConstructors()

Overrides javassist.CtClass.getDeclaredConstructors.

Gets all the constructors declared in the class.

public CtField
getDeclaredField(String name)

Overrides javassist.CtClass.getDeclaredField.

Retrieves the field with the specified name among the fields declared in the class.

public CtField
getDeclaredField(String
the field name.
name
,
String
the type descriptor of the field. It is available by CtField#getSignature().
desc
)

Overrides javassist.CtClass.getDeclaredField.

Retrieves the field with the specified name and type among the fields declared in the class.

private CtField
public CtField[]
getDeclaredFields()

Overrides javassist.CtClass.getDeclaredFields.

Gets all the fields declared in the class.

public CtMethod
getDeclaredMethod(String name)

Overrides javassist.CtClass.getDeclaredMethod.

Retrieves the method with the specified name among the methods declared in the class.

public CtMethod
getDeclaredMethod(String
method name
name
,
CtClass[]
parameter types
params
)

Overrides javassist.CtClass.getDeclaredMethod.

Retrieves the method with the specified name and parameter types among the methods declared in the class.

public CtMethod[]
getDeclaredMethods()

Overrides javassist.CtClass.getDeclaredMethods.

Gets all methods declared in the class.

public CtMethod[]
getDeclaredMethods(String
method name.
name
)

Overrides javassist.CtClass.getDeclaredMethods.

Retrieves methods with the specified name among the methods declared in the class.

public CtClass
getDeclaringClass()

Overrides javassist.CtClass.getDeclaringClass.

If this class is a member class or interface of another class, then the class enclosing this class is returned.

public CtBehavior
getEnclosingBehavior()

Overrides javassist.CtClass.getEnclosingBehavior.

Returns the immediately enclosing method of this class.

public CtField
getField(String
the field name.
name
,
String
the type descriptor of the field. It is available by CtField#getSignature().
desc
)

Overrides javassist.CtClass.getField.

Returns the field with the specified name and type.

pack-priv CtField
public CtField[]
getFields()

Overrides javassist.CtClass.getFields.

Returns an array containing CtField objects representing all the non-private fields of the class.

private static void
public String
getGenericSignature()

Overrides javassist.CtClass.getGenericSignature.

Returns the generic signature of the class.

pack-priv Map<CtMethod, String>
public CtClass[]
getInterfaces()

Overrides javassist.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.

protected synchronized CtMember.Cache
public CtMethod
getMethod(String
method name
name
,
String
method descriptor
desc
)

Overrides javassist.CtClass.getMethod.

Returns the method with the given name and signature.

private static CtMethod
getMethod0(CtClass cc, String name, String desc)

public CtMethod[]
getMethods()

Overrides javassist.CtClass.getMethods.

Returns an array containing CtMethod objects representing all the non-private methods of the class.

private static void
public int
getModifiers()

Overrides javassist.CtClass.getModifiers.

Returns the modifiers for this class, encoded in an integer.

public CtClass[]
getNestedClasses()

Overrides javassist.CtClass.getNestedClasses.

Returns an array of nested classes declared in the class.

public CtClass
getSuperclass()

Overrides javassist.CtClass.getSuperclass.

Obtains the class object representing the superclass of the class.

pack-priv int
public URL
getURL()

Overrides javassist.CtClass.getURL.

Returns the uniform resource locator (URL) of the class file.

public boolean
hasAnnotation(String
the name of annotation type.
annotationName
)

Overrides javassist.CtClass.hasAnnotation.

Returns true if the class has the specified annotation type.

pack-priv static boolean
pack-priv static boolean
protected CtMember.Cache
hasMemberCache()

Returns null if members are not cached.

pack-priv final void
private static void
insertAuxInitializer(CodeAttribute codeAttr, Bytecode initializer, int stacksize)

public void
instrument(CodeConverter
specifies how to modify.
converter
)

Overrides javassist.CtClass.instrument.

Applies the given converter to all methods and constructors declared in the class.

public void
instrument(ExprEditor
specifies how to modify.
editor
)

Overrides javassist.CtClass.instrument.

Modifies the bodies of all methods and constructors declared in the class.

public boolean
isAnnotation()

Overrides javassist.CtClass.isAnnotation.

Determines whether this object represents an annotation type.

public boolean
isEnum()

Overrides javassist.CtClass.isEnum.

Determines whether this object represents an enum.

public boolean
isFrozen()

Overrides javassist.CtClass.isFrozen.

Returns true if the class has been loaded or written out and thus it cannot be modified any more.

public boolean
isInterface()

Overrides javassist.CtClass.isInterface.

Determines whether this object represents a class or an interface.

public boolean
isModified()

Overrides javassist.CtClass.isModified.

Returns true if the definition of the class has been modified.

private static boolean
private void
public CtConstructor
makeClassInitializer()

Overrides javassist.CtClass.makeClassInitializer.

Makes an empty class initializer (static constructor).

private void
private int
private void
public CtClass
makeNestedClass(String
the simple name of the nested class.
name
,
boolean
true if the nested class is static.
isStatic
)

Overrides javassist.CtClass.makeNestedClass.

Makes a new public nested class.

public String
makeUniqueName(String
the prefix of the member name.
prefix
)

Overrides javassist.CtClass.makeUniqueName.

Makes a unique member name.

private void
private void
modifyClassConstructor(ClassFile cf, Bytecode code, int stacksize, int localsize)

private void
private void
private static boolean
notFindInArray(String prefix, String[] values)

public void
prune()

Overrides javassist.CtClass.prune.

Discards unnecessary attributes, in particular, CodeAttributes (method bodies) of the class, to minimize the memory footprint.

public void
rebuildClassFile()

Overrides javassist.CtClass.rebuildClassFile.

If this method is called, the class file will be rebuilt when it is finally generated by toBytecode() and writeFile().

private synchronized void
public void
removeConstructor(CtConstructor
removed constructor.
m
)

Overrides javassist.CtClass.removeConstructor.

Removes a constructor declared in this class.

public void
removeField(CtField
removed field.
f
)

Overrides javassist.CtClass.removeField.

Removes a field declared in this class.

public void
removeMethod(CtMethod
removed method.
m
)

Overrides javassist.CtClass.removeMethod.

Removes a method declared in this class.

public void
replaceClassName(ClassMap
the hashtable associating replaced class names with substituted names.
classnames
)

Overrides javassist.CtClass.replaceClassName.

Changes class names appearing in the class file according to the given map.

public void
replaceClassName(String
replaced class name
oldname
,
String
substituted class name
newname
)

Overrides javassist.CtClass.replaceClassName.

Substitutes newName for all occurrences of a class name oldName in the class file.

private synchronized void
saveClassFile()

Converts a ClassFile object into a byte array for saving memory space.

public void
setAttribute(String
attribute name
name
,
byte[]
attribute value
data
)

Overrides javassist.CtClass.setAttribute.

Adds a named attribute.

private synchronized ClassFile
setClassFile(ClassFile cf)

Updates classfile if it is null.

pack-priv void
public void
setGenericSignature(String
a generic signature.
sig
)

Overrides javassist.CtClass.setGenericSignature.

Sets the generic signature of the class.

public void
setInterfaces(CtClass[]
a list of the CtClass objects representing interfaces, or null if the class implements no interfaces.
list
)

Overrides javassist.CtClass.setInterfaces.

Sets implemented interfaces.

public void
setModifiers(int
modifiers encoded by javassist.Modifier
mod
)

Overrides javassist.CtClass.setModifiers.

Sets the modifiers.

public void
setName(String
fully-qualified name
name
)

Overrides javassist.CtClass.setName.

Sets the class name

public void
setSuperclass(CtClass clazz)

Overrides javassist.CtClass.setSuperclass.

Changes a super class unless this object represents an interface.

public boolean
stopPruning(boolean
disallow pruning if true. Otherwise, allow.
stop
)

Overrides javassist.CtClass.stopPruning.

Disallows (or allows) automatically pruning this CtClass object.

public boolean
subclassOf(CtClass superclass)

Overrides javassist.CtClass.subclassOf.

Determines whether the class directly or indirectly extends the given class.

public boolean
subtypeOf(CtClass clazz)

Overrides javassist.CtClass.subtypeOf.

Returns true if this class extends or implements clazz.

pack-priv static Object[]
pack-priv static Object[][]
private static Object
public void
toBytecode(DataOutputStream
the output stream that a class file is written to.
out
)

Overrides javassist.CtClass.toBytecode.

Converts this class to a class file.

private static void
updateInnerEntry(int newMod, String name, CtClass clazz, boolean outer)

Inherited from javassist.CtClass:
addFielddebugWriteFiledebugWriteFiledetachgetClassFilegetComponentTypegetDeclaredClassesgetDeclaredConstructorgetEnclosingMethodgetFieldgetNamegetPackageNamegetRefClassesgetSimpleNamehasAnnotationisArrayisKotlinisPrimitivemainmakeFileOutputtoBytecodetoClasstoClasstoClasstoClasstoClasstoStringwriteFilewriteFile