jellyj.classfile.classgen
Class ClassGen


public final class ClassGen
implements Constants

Template class for building up a java class. May be initialized by an existing java class (file).

Author:
JellyJ Design Group
See Also: JavaClass

Constructor Summary
ClassGen(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces)
           
ClassGen(JavaClass clazz)
          Initialize with existing class.

Method Summary
 final voidaddAttribute(Attribute a)
          Add an attribute to this class.
 final voidaddField(Field f)
          Add a field to this class.
 final voidaddInterface(String i)
          Add an interface to this class, i.e.
 final voidaddMethod(Method m)
          Add a method to this class.
 intgetAccessFlags()
           
 StringgetClassName()
           
 ConstantPoolGengetConstantPool()
           
 StringgetFileName()
           
 JavaClassgetJavaClass()
           
 StringgetSuperclassName()
           
 final voidremoveAttribute(Attribute a)
          Remove an attribute from this class.
 final voidremoveField(Field f)
          Remove a field to this class.
 final voidremoveMethod(Method m)
          Remove a method from this class.

Constructor Detail

ClassGen

public ClassGen(String class_name, String super_class_name, String file_name, int access_flags, String[] interfaces)
Parameters:
class_name - fully qualified class name
super_class_name - fully qualified superclass name
file_name - source file name
access_flags - access qualifiers
interfaces - implemented interfaces

ClassGen

public ClassGen(JavaClass clazz)
Initialize with existing class.
Parameters:
clazz - JavaClass object (e.g. read from file)
Method Detail

addAttribute

public final void addAttribute(Attribute a)
Add an attribute to this class.
Parameters:
a - attribute to add

addField

public final void addField(Field f)
Add a field to this class.
Parameters:
f - field to add

addInterface

public final void addInterface(String i)
Add an interface to this class, i.e. this class has to implement it.
Parameters:
i - interface to implement (fully qualified class name)

addMethod

public final void addMethod(Method m)
Add a method to this class.
Parameters:
m - method to add

getAccessFlags

public int getAccessFlags()

getClassName

public String getClassName()

getConstantPool

public ConstantPoolGen getConstantPool()

getFileName

public String getFileName()

getJavaClass

public JavaClass getJavaClass()
Returns: the (finally) built up Java class object.

getSuperclassName

public String getSuperclassName()

removeAttribute

public final void removeAttribute(Attribute a)
Remove an attribute from this class.
Parameters:
a - attribute to remove

removeField

public final void removeField(Field f)
Remove a field to this class.
Parameters:
f - field to remove

removeMethod

public final void removeMethod(Method m)
Remove a method from this class.
Parameters:
m - method to remove

Association Links

to Class java.lang.String

to Class jellyj.classfile.classgen.ConstantPoolGen

to Class java.util.Vector

to Class java.util.Vector

to Class java.util.Vector

to Class java.util.Vector