All Packages Class Hierarchy This Package Previous Next Index
Class gnu.bytecode.ClassType
java.lang.Object
|
+----gnu.bytecode.Type
|
+----gnu.bytecode.ObjectType
|
+----gnu.bytecode.ClassType
- public class ClassType
- extends ObjectType
- implements AttrContainer
-
access_flags
-
-
constructor
-
-
major_version
-
-
minor_version
-
-
ClassType()
-
-
ClassType(String)
-
-
addField()
- Add a new field to this class.
-
addField(String)
- Add a new field to this class, and name the field.
-
addField(String, Type)
-
-
addField(String, Type, int)
-
-
addMethod(String)
-
-
addMethod(String, int)
-
-
addMethod(String, int, Type[], Type)
- Add a method to this ClassType.
-
addMethod(String, String, int)
-
-
addMethod(String, Type[], Type, int)
-
-
constructors()
-
-
doFixups()
- Do various fixups after generating code but before we can write it out.
-
fields()
-
-
getAttributes()
-
-
getConstant(int)
-
-
getConstants()
-
-
getField(String)
- Find a field with the given name,or null.
-
getInterfaces()
-
-
getModifiers()
- Return the modifiers (access flags) for this class.
-
getNameOrSignature()
-
-
getSourceFile()
- Get the name of the SourceFile associated with this class.
-
getSuper()
-
-
make(String)
- Find a ClassType with the given name, or create a new one.
-
methods()
-
-
setAttributes(Attribute)
-
-
setInterfaces(ClassType[])
-
-
setModifiers(int)
- Set the modifiers (access flags) for this class.
-
setSourceFile(String)
- Set the name of the SourceFile associated with this class.
-
setSuper(ClassType)
-
-
setSuper(String)
- Set the superclass of the is class.
-
to_utf8(String)
- Convert a String to a Utf8 byte array.
-
toString()
-
-
writeToArray()
-
-
writeToFile()
-
-
writeToFile(String)
-
-
writeToStream(OutputStream)
-
minor_version
public static final int minor_version
major_version
public static final int major_version
access_flags
public int access_flags
constructor
public Method constructor
ClassType
public ClassType()
ClassType
public ClassType(String class_name)
make
public static ClassType make(String name)
- Find a ClassType with the given name, or create a new one.
Use this for "library classes", where you need the field/method types,
but not one where you are about to generate code for.
- Parameters:
- name - the name of the class (e..g. "java.lang.String").
getAttributes
public final Attribute getAttributes()
setAttributes
public final void setAttributes(Attribute attributes)
getConstants
public final ConstantPool getConstants()
getConstant
public final CpoolEntry getConstant(int i)
getModifiers
public final int getModifiers()
- Return the modifiers (access flags) for this class.
setModifiers
public final void setModifiers(int flags)
- Set the modifiers (access flags) for this class.
setSourceFile
public void setSourceFile(String name)
- Set the name of the SourceFile associated with this class.
getSourceFile
public String getSourceFile()
- Get the name of the SourceFile associated with this class.
setSuper
public void setSuper(String name)
- Set the superclass of the is class.
- Parameters:
- name - name of super class, or null if this is "Object".
setSuper
public void setSuper(ClassType superClass)
getSuper
public ClassType getSuper()
getInterfaces
public ClassType[] getInterfaces()
getNameOrSignature
public String getNameOrSignature()
- Overrides:
- getNameOrSignature in class ObjectType
setInterfaces
public void setInterfaces(ClassType interfaces[])
getField
public Field getField(String name)
- Find a field with the given name,or null.
addField
public Field addField()
- Add a new field to this class.
addField
public Field addField(String name)
- Add a new field to this class, and name the field.
- Parameters:
- name - the name of the new field
addField
public final Field addField(String name,
Type type)
addField
public final Field addField(String name,
Type type,
int flags)
addMethod
public Method addMethod(String name)
addMethod
public Method addMethod(String name,
int flags)
addMethod
public Method addMethod(String name,
Type arg_types[],
Type return_type,
int flags)
addMethod
public Method addMethod(String name,
int flags,
Type arg_types[],
Type return_type)
- Add a method to this ClassType.
If an existing method matches, return that. Otherwise, create
a new one.
In contrast, the other addMethod methods always create new Methods.
addMethod
public Method addMethod(String name,
String signature,
int flags)
methods
public Enumeration methods()
fields
public Enumeration fields()
constructors
public Enumeration constructors()
doFixups
public void doFixups()
- Do various fixups after generating code but before we can write it out.
This includes assigning constant pool indexes where needed,
finalizing labels, etc.
writeToStream
public void writeToStream(OutputStream stream) throws IOException
writeToFile
public void writeToFile(String filename) throws IOException
writeToFile
public void writeToFile() throws IOException
writeToArray
public byte[] writeToArray() throws IOException
to_utf8
public static byte[] to_utf8(String str)
- Convert a String to a Utf8 byte array.
- Parameters:
- str - the input String.
- Returns:
- the input encoded as a utf8 byte array.
toString
public String toString()
- Overrides:
- toString in class Type
All Packages Class Hierarchy This Package Previous Next Index