koala.dynamicjava.classfile
Class ClassFile

java.lang.Object
  extended bykoala.dynamicjava.classfile.BytecodeComponent
      extended bykoala.dynamicjava.classfile.AttributeOwnerComponent
          extended bykoala.dynamicjava.classfile.ClassFile
Direct Known Subclasses:
ClassFactory

public class ClassFile
extends AttributeOwnerComponent

This class allows the creation of JVM bytecode class format outputs


Field Summary
 
Fields inherited from class koala.dynamicjava.classfile.AttributeOwnerComponent
accessFlags, attributes
 
Fields inherited from class koala.dynamicjava.classfile.BytecodeComponent
constantPool, nameIndex
 
Constructor Summary
ClassFile(java.lang.String name, java.lang.String sname)
          Creates a new ClassFile structure
 
Method Summary
 void addInterface(java.lang.String name)
          Adds an interface to the list of the implemented interfaces
 FieldInfo createField(java.lang.String tp, java.lang.String nm)
          Creates a new field
 MethodInfo createMethod(java.lang.String rt, java.lang.String nm, java.lang.String[] pt)
          Creates a new method
 ConstantPool getConstantPool()
          Returns the constant pool
 void setAbstract()
          Sets the abstract flag for this class
 void setFinal()
          Sets the final flag for this class
 void setInnerClassesAttribute(InnerClassesAttribute attr)
          Sets the innerclasses attribute to the class
 void setInterface()
          Sets the interface flag for this class
 void setPublic()
          Sets the public flag for this class
 void setSuper()
          Sets the super flag for this class
 void write(java.io.DataOutputStream out)
          Writes the class file to the given output stream
 
Methods inherited from class koala.dynamicjava.classfile.AttributeOwnerComponent
setAccessFlags, setSyntheticAttribute
 
Methods inherited from class koala.dynamicjava.classfile.BytecodeComponent
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassFile

public ClassFile(java.lang.String name,
                 java.lang.String sname)
Creates a new ClassFile structure

Parameters:
name - the name of this class
sname - the name of the superclass
Method Detail

getConstantPool

public ConstantPool getConstantPool()
Returns the constant pool

Overrides:
getConstantPool in class BytecodeComponent

write

public void write(java.io.DataOutputStream out)
           throws java.io.IOException
Writes the class file to the given output stream

Specified by:
write in class BytecodeComponent
Throws:
java.io.IOException

setPublic

public void setPublic()
Sets the public flag for this class


setFinal

public void setFinal()
Sets the final flag for this class


setSuper

public void setSuper()
Sets the super flag for this class


setInterface

public void setInterface()
Sets the interface flag for this class


setAbstract

public void setAbstract()
Sets the abstract flag for this class


addInterface

public void addInterface(java.lang.String name)
Adds an interface to the list of the implemented interfaces


createField

public FieldInfo createField(java.lang.String tp,
                             java.lang.String nm)
Creates a new field

Parameters:
tp - the type of the field
nm - the name of the field
See Also:
for a description of the type format

createMethod

public MethodInfo createMethod(java.lang.String rt,
                               java.lang.String nm,
                               java.lang.String[] pt)
Creates a new method

Parameters:
rt - the return type
nm - the name of the method
pt - the parameter types
See Also:
for a description of the type format

setInnerClassesAttribute

public void setInnerClassesAttribute(InnerClassesAttribute attr)
Sets the innerclasses attribute to the class

Parameters:
attr - the attribute to set


Copyright © 2001 Stephane Hillion. All Rights Reserved.