All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class de.fub.bytecode.generic.ClassGen

java.lang.Object
   |
   +----de.fub.bytecode.classfile.AccessFlags
           |
           +----de.fub.bytecode.generic.ClassGen

public class ClassGen
extends AccessFlags
implements Constants
Template class for building up a java class. May be initialized by an existing java class (file).

Version:
$Id: ClassGen.java,v 1.11 1999/08/13 08:18:25 dahm Exp $
Author:
M. Dahm
See Also:
JavaClass

Constructor Index

 o ClassGen(JavaClass)
Initialize with existing class.
 o ClassGen(String, String, String, int, String[])

Method Index

 o addAttribute(Attribute)
Add an attribute to this class.
 o addEmptyConstructor(int)
Convenience method.
 o addField(Field)
Add a field to this class.
 o addInterface(int)
Add an interface to this class, i.e.
 o addInterface(String)
Add an interface to this class, i.e.
 o addMethod(Method)
Add a method to this class.
 o containsField(Field)
 o containsField(String)
 o containsMethod(String, String)
 o getAttributes()
 o getClassName()
 o getClassNameIndex()
 o getConstantPool()
 o getFields()
 o getFileName()
 o getInterfaces()
 o getJavaClass()
 o getMethods()
 o getSuperclassName()
 o getSuperclassNameIndex()
 o removeAttribute(Attribute)
Remove an attribute from this class.
 o removeField(Field)
Remove a field to this class.
 o removeInterface(int)
Remove an interface from this class.
 o removeMethod(Method)
Remove a method from this class.
 o setClassNameIndex(int)
 o setConstantPool(ConstantPoolGen)
 o setMethods(Method[])
 o setSuperclassNameIndex(int)

Constructors

 o 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
 o ClassGen
 public ClassGen(JavaClass clazz)
Initialize with existing class.

Parameters:
clazz - JavaClass object (e.g. read from file)

Methods

 o getJavaClass
 public JavaClass getJavaClass()
Returns:
the (finally) built up Java class object.
 o addInterface
 public 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)
 o addInterface
 public void addInterface(int i)
Add an interface to this class, i.e. this class has to implement it.

Parameters:
i - interface to implement (must be index in constant pool pointing to a ConstantClass)
 o removeInterface
 public void removeInterface(int i)
Remove an interface from this class.

Parameters:
i - interface to remove (index in constant pool)
 o addAttribute
 public void addAttribute(Attribute a)
Add an attribute to this class.

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

Parameters:
m - method to add
 o addEmptyConstructor
 public void addEmptyConstructor(int access_flags)
Convenience method. Add an empty constructor to this class that does nothing but calling super().

Parameters:
access - rights for constructor
 o addField
 public void addField(Field f)
Add a field to this class.

Parameters:
f - field to add
 o containsField
 public boolean containsField(Field f)
 o containsField
 public Field containsField(String name)
 o containsMethod
 public Method containsMethod(String name,
                              String signature)
 o removeAttribute
 public void removeAttribute(Attribute a)
Remove an attribute from this class.

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

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

Parameters:
f - field to remove
 o getClassName
 public String getClassName()
 o getSuperclassName
 public String getSuperclassName()
 o getFileName
 public String getFileName()
 o getMethods
 public Method[] getMethods()
 o setMethods
 public void setMethods(Method methods[])
 o getInterfaces
 public int[] getInterfaces()
 o getFields
 public Field[] getFields()
 o getAttributes
 public Attribute[] getAttributes()
 o getConstantPool
 public ConstantPoolGen getConstantPool()
 o setConstantPool
 public void setConstantPool(ConstantPoolGen constant_pool)
 o setClassNameIndex
 public void setClassNameIndex(int class_name_index)
 o setSuperclassNameIndex
 public void setSuperclassNameIndex(int superclass_name_index)
 o getSuperclassNameIndex
 public int getSuperclassNameIndex()
 o getClassNameIndex
 public int getClassNameIndex()

All Packages  Class Hierarchy  This Package  Previous  Next  Index