class CtNewClass extends CtClassType
CtClass.DelayedFileOutputStream
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasConstructor |
classfile, classPool, gcConstPool, rawClassfile, wasChanged, wasPruned
booleanType, byteType, charType, debugDump, doubleType, floatType, intType, javaLangObject, longType, primitiveTypes, qualifiedName, shortType, version, voidType
Constructor and Description |
---|
CtNewClass(java.lang.String name,
ClassPool cp,
boolean isInterface,
CtClass superclass) |
Modifier and Type | Method and Description |
---|---|
void |
addConstructor(CtConstructor c)
Adds a constructor.
|
protected void |
extendToString(java.lang.StringBuffer buffer)
Implemented in subclasses to add to the
CtClass.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.
|
addField, addField, addInterface, addMethod, checkModify, compress, defrost, freeze, getAccessorMaker, getAnnotation, getAnnotations, getAnnotationType, getAttribute, getAvailableAnnotations, getClassFile2, getClassInitializer, getClassPool, getConstructor, getConstructors, getDeclaredBehaviors, getDeclaredConstructors, getDeclaredField, getDeclaredField, getDeclaredFields, getDeclaredMethod, getDeclaredMethod, getDeclaredMethods, getDeclaringClass, getEnclosingMethod, getField, getField2, getFields, getGenericSignature, getHiddenMethods, getInterfaces, getMembers, getMethod, getMethods, getModifiers, getNestedClasses, getSuperclass, getUniqueNumber, getURL, hasAnnotation, 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
addField, debugWriteFile, debugWriteFile, detach, getClassFile, getComponentType, getDeclaredClasses, getDeclaredConstructor, getField, getName, getPackageName, getRefClasses, getSimpleName, isArray, isPrimitive, main, makeFileOutput, toBytecode, toClass, toClass, toClass, toString, writeFile, writeFile
protected void extendToString(java.lang.StringBuffer buffer)
CtClass
CtClass.toString()
result.
Subclasses should put a space before each token added to the buffer.extendToString
in class CtClassType
public void addConstructor(CtConstructor c) throws CannotCompileException
CtClass
makeClassInitializer()
.addConstructor
in class CtClassType
CannotCompileException
CtClass.makeClassInitializer()
public void toBytecode(java.io.DataOutputStream out) throws CannotCompileException, java.io.IOException
CtClass
This method dose not close the output stream in the end.
toBytecode
in class CtClassType
out
- the output stream that a class file is written to.CannotCompileException
java.io.IOException
public void inheritAllConstructors() throws CannotCompileException, NotFoundException
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.
private boolean isInheritable(int mod, CtClass superclazz)