public class ClassWriter
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private int |
accessFlags |
private FieldWriter |
firstField
The fields of this class, stored in a linked list of
FieldWriter linked via their
FieldWriter.fv field. |
private MethodWriter |
firstMethod |
private int |
interfaceCount
The interface_count field of the JVMS ClassFile structure.
|
private int[] |
interfaces
The 'interfaces' array of the JVMS ClassFile structure.
|
private FieldWriter |
lastField
The fields of this class, stored in a linked list of
FieldWriter linked via their
FieldWriter.fv field. |
private MethodWriter |
lastMethod |
private int |
superClass
The super_class field of the JVMS ClassFile structure.
|
private SymbolTable |
symbolTable
The symbol table for this class (contains the constant_pool and the BootstrapMethods).
|
private int |
thisClass
The this_class field of the JVMS ClassFile structure.
|
private java.util.function.Function<java.lang.String,java.lang.Class> |
typeProvider |
private int |
version
The minor_version and major_version fields of the JVMS ClassFile structure.
|
| Constructor and Description |
|---|
ClassWriter(java.util.function.Function<java.lang.String,java.lang.Class> typeProvider) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
getCommonSuperClass(java.lang.String type1,
java.lang.String type2)
Returns the common super type of the two given types.
|
protected java.lang.Class |
loadClass(java.lang.String type) |
byte[] |
toByteArray()
Returns the content of the class file that was built by this ClassWriter.
|
void |
visit(int version,
int access,
java.lang.String name,
java.lang.String superName,
java.lang.String[] interfaces) |
FieldWriter |
visitField(int access,
java.lang.String name,
java.lang.String descriptor) |
MethodWriter |
visitMethod(int access,
java.lang.String name,
java.lang.String descriptor,
int codeInitCapacity) |
private final java.util.function.Function<java.lang.String,java.lang.Class> typeProvider
private int version
private final SymbolTable symbolTable
private int accessFlags
private int thisClass
private int superClass
private int interfaceCount
private int[] interfaces
private FieldWriter firstField
FieldWriter linked via their
FieldWriter.fv field. This field stores the first element of this list.private FieldWriter lastField
FieldWriter linked via their
FieldWriter.fv field. This field stores the last element of this list.private MethodWriter firstMethod
private MethodWriter lastMethod
public ClassWriter(java.util.function.Function<java.lang.String,java.lang.Class> typeProvider)
public final void visit(int version,
int access,
java.lang.String name,
java.lang.String superName,
java.lang.String[] interfaces)
public final FieldWriter visitField(int access, java.lang.String name, java.lang.String descriptor)
public final MethodWriter visitMethod(int access, java.lang.String name, java.lang.String descriptor, int codeInitCapacity)
public byte[] toByteArray()
protected java.lang.Class loadClass(java.lang.String type)
protected java.lang.String getCommonSuperClass(java.lang.String type1,
java.lang.String type2)
type1 - the internal name of a class.type2 - the internal name of another class.