net.sf.transjvm
Class TClass

java.lang.Object
  extended by net.sf.transjvm.TClass

public class TClass
extends java.lang.Object

A class used for building JVM class files.

Author:
Mark Shannon

Constructor Summary
TClass(java.lang.String name, int flags)
          Equivalent to TClass(name, modifier, true).
TClass(java.lang.String name, int flags, boolean _super)
          Creates a new TClass object
 
Method Summary
 void add(TConstructor constructor)
          Adds a constructor
 void add(TField field)
          Adds a field
 void add(TMethod method)
          Adds a method
 void addDefaultConstructor()
          Adds the default constructor to this class.
 byte[] getBytes()
          Returns the byte array for this TClass, in standard JVM class file format.
 void implement(TypeID interfaceType)
          Adds an interface to the list of interfaces implemented by this class.
 void setSourceFile(java.lang.String sourceName)
          Sets the source file of this TClass for debugging.
 void setSuper(TypeID superType)
          Sets the super type of this TClass.
 void setVersion(int majorVersion, int minorVersion)
          Sets the version numbers
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TClass

public TClass(java.lang.String name,
              int flags,
              boolean _super)
Creates a new TClass object

Parameters:
name - The name of this class.
flags - Flags for this class
_super - Defines semantics for invoke-special, should almost always be true.
See Also:
Flags

TClass

public TClass(java.lang.String name,
              int flags)
Equivalent to TClass(name, modifier, true).

Method Detail

setSuper

public void setSuper(TypeID superType)
Sets the super type of this TClass. Do not use this method after addDefaultConstructor(). If this method is not called, the super type will default to java.lang.Object

Parameters:
superType - The super class
Throws:
java.lang.IllegalArgumentException - if superType is primitive or array.

setSourceFile

public void setSourceFile(java.lang.String sourceName)
Sets the source file of this TClass for debugging.

Parameters:
sourceName - The short file name of the source file.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setVersion

public void setVersion(int majorVersion,
                       int minorVersion)
Sets the version numbers

Parameters:
majorVersion - The new major version value
minorVersion - The new minor version value

add

public void add(TMethod method)
Adds a method

Parameters:
method - The method to be added to this class.

add

public void add(TConstructor constructor)
Adds a constructor

Parameters:
constructor - The constructor to be added to this class.

add

public void add(TField field)
Adds a field

Parameters:
field - The field to be added to this class.

implement

public void implement(TypeID interfaceType)
Adds an interface to the list of interfaces implemented by this class.

Parameters:
interfaceType - The interface this class claims to implement
Throws:
java.lang.IllegalArgumentException - if interfaceType is a primitive or array type.

getBytes

public byte[] getBytes()
Returns the byte array for this TClass, in standard JVM class file format.

Returns:
The byte array for this TClass

addDefaultConstructor

public void addDefaultConstructor()
Adds the default constructor to this class. Do not use this method before setSuper(TypeID).



Copyright 2004-5, Mark Shannon