Package javassist
Class CtNewClass
- java.lang.Object
-
- javassist.CtClass
-
- javassist.CtClassType
-
- javassist.CtNewClass
-
class CtNewClass extends CtClassType
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javassist.CtClass
CtClass.DelayedFileOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
hasConstructor
-
Fields inherited from class javassist.CtClassType
classfile, classPool, gcConstPool, rawClassfile, wasChanged, wasPruned
-
Fields inherited from class javassist.CtClass
booleanType, byteType, charType, debugDump, doubleType, floatType, intType, javaLangObject, longType, primitiveTypes, qualifiedName, shortType, version, voidType
-
-
Constructor Summary
Constructors Constructor Description CtNewClass(java.lang.String name, ClassPool cp, boolean isInterface, CtClass superclass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConstructor(CtConstructor c)
Adds a constructor.protected void
extendToString(java.lang.StringBuilder buffer)
Implemented in subclasses to add to theCtClass.toString()
result.void
inheritAllConstructors()
Adds constructors inhrited from the super class.private boolean
isInheritable(int mod, CtClass superclazz)
void
toBytecode(java.io.DataOutputStream out)
Converts this class to a class file.-
Methods inherited from class javassist.CtClassType
addField, addField, addInterface, addMethod, checkModify, compress, defrost, freeze, getAccessorMaker, getAnnotation, getAnnotations, getAnnotationType, getAttribute, getAvailableAnnotations, getClassFile2, getClassFile3, getClassInitializer, getClassPool, getConstructor, getConstructors, getDeclaredBehaviors, getDeclaredConstructors, getDeclaredField, getDeclaredField, getDeclaredFields, getDeclaredMethod, getDeclaredMethod, getDeclaredMethods, getDeclaredMethods, getDeclaringClass, getEnclosingBehavior, getField, getField2, getFields, getGenericSignature, getHiddenMethods, getInterfaces, getMembers, getMethod, getMethods, getModifiers, getNestedClasses, getSuperclass, getUniqueNumber, getURL, hasAnnotation, hasAnnotationType, hasAnnotationType, hasMemberCache, incGetCounter, instrument, instrument, isAnnotation, isEnum, isFrozen, isInterface, isModified, makeClassInitializer, makeNestedClass, makeUniqueName, prune, rebuildClassFile, removeConstructor, removeField, removeMethod, replaceClassName, replaceClassName, setAttribute, setClassPool, setGenericSignature, setInterfaces, setModifiers, setName, setSuperclass, stopPruning, subclassOf, subtypeOf, toAnnotationType, toAnnotationType
-
Methods inherited from class javassist.CtClass
addField, debugWriteFile, debugWriteFile, detach, getClassFile, getComponentType, getDeclaredClasses, getDeclaredConstructor, getEnclosingMethod, getField, getName, getPackageName, getRefClasses, getSimpleName, hasAnnotation, isArray, isKotlin, isPrimitive, main, makeFileOutput, toBytecode, toClass, toClass, toClass, toClass, toClass, toString, writeFile, writeFile
-
-
-
-
Method Detail
-
extendToString
protected void extendToString(java.lang.StringBuilder buffer)
Description copied from class:CtClass
Implemented in subclasses to add to theCtClass.toString()
result. Subclasses should put a space before each token added to the buffer.- Overrides:
extendToString
in classCtClassType
-
addConstructor
public void addConstructor(CtConstructor c) throws CannotCompileException
Description copied from class:CtClass
Adds a constructor. To add a class initializer (static constructor), callmakeClassInitializer()
.- Overrides:
addConstructor
in classCtClassType
- Throws:
CannotCompileException
- See Also:
CtClass.makeClassInitializer()
-
toBytecode
public void toBytecode(java.io.DataOutputStream out) throws CannotCompileException, java.io.IOException
Description copied from class:CtClass
Converts this class to a class file. Once this method is called, further modifications are not possible any more.This method dose not close the output stream in the end.
- Overrides:
toBytecode
in classCtClassType
- Parameters:
out
- the output stream that a class file is written to.- Throws:
CannotCompileException
java.io.IOException
-
inheritAllConstructors
public void inheritAllConstructors() throws CannotCompileException, NotFoundException
Adds constructors inhrited from the super class.After this method is called, the class inherits all the constructors from the super class. The added constructor calls the super's constructor with the same signature.
-
isInheritable
private boolean isInheritable(int mod, CtClass superclazz)
-
-