Class jas.ClassEnv
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jas.ClassEnv

java.lang.Object
   |
   +----jas.ClassEnv

public class ClassEnv
extends Object
implements RuntimeConstants
This is the place where all information about the class to be created resides.

Constructor Index

 o ClassEnv()

Method Index

 o addCPItem(CP)
This is the method to add CPE items to a class.
 o addField(Var)
 o addGenericAttr(GenericAttr)
Add a generic attribute to the class file.
 o addInterface(CP)
Add this CP to the list of interfaces supposedly implemented by this class.
 o addInterface(CP[])
Add this to the list of interfaces supposedly implemented by this class.
 o addMethod(short, String, String, CodeAttr, ExceptAttr)
Here is where code gets added to a class.
 o addMethod(Method)
This allows more control over generating CP's for methods if you feel so inclined.
 o setClass(CP)
Define this class to have this name.
 o setClassAccess(short)
Set the class access for this class.
 o setSource(SourceAttr)
Add an attribute specifying the name of the source file for the class
 o setSource(String)
Add an attribute specifying the name of the source file for the clas.
 o setSuperClass(CP)
Define this class to have this superclass
 o write(DataOutputStream)
Write the contents of the class.

Constructors

 o ClassEnv
  public ClassEnv()

Methods

 o setClass
  public void setClass(CP name)
Define this class to have this name.
Parameters:
name - CPE representing name for class. (This is usually a ClassCP)
 o setSuperClass
  public void setSuperClass(CP name)
Define this class to have this superclass
Parameters:
name - CPE representing name for class. (This is usually a ClassCP)
 o setClassAccess
  public void setClassAccess(short access)
Set the class access for this class. Constants understood by this are present along with the java Beta distribution.
Parameters:
access - number representing access permissions for the entire class.
See Also:
RuntimeConstants
 o addInterface
  public void addInterface(CP ifc)
Add this CP to the list of interfaces supposedly implemented by this class. Note that the CP ought to be a ClassCP to make sense to the VM.
 o addInterface
  public void addInterface(CP ilist[])
Add this to the list of interfaces supposedly implemented by this class. Note that each CP is usually a ClassCP.
Parameters:
ilist - An array of CP items representing the interfaces implemented by this class.
 o addField
  public void addField(Var v)
 o write
  public void write(DataOutputStream out) throws IOException, jasError
Write the contents of the class.
Parameters:
out - DataOutputStream on which the contents are written.
 o addCPItem
  public void addCPItem(CP cp)
This is the method to add CPE items to a class. CPE items for a class are "uniquefied". Ie, if you add a CPE items whose contents already exist in the class, only one entry is finally written out when the class is written.
Parameters:
cp - Item to be added to the class
 o addMethod
  public void addMethod(short acc,
                        String name,
                        String sig,
                        CodeAttr code,
                        ExceptAttr ex)
Here is where code gets added to a class.
Parameters:
acc - method_access permissions, expressed with some combination of the values defined in RuntimeConstants
name - Name of the method
sig - Signature for the method
code - Actual code for the method
ex - Any exception attribute to be associated with method
 o setSource
  public void setSource(SourceAttr source)
Add an attribute specifying the name of the source file for the class
Parameters:
source - SourceAttribute specifying the source for the file
 o setSource
  public void setSource(String source)
Add an attribute specifying the name of the source file for the clas.
Parameters:
source - String with the name of the class
 o addGenericAttr
  public void addGenericAttr(GenericAttr g)
Add a generic attribute to the class file. A generic attribute contains a stream of uninterpreted bytes which is ignored by the VM (as long as its name doesn't conflict with other names for attributes that are understood by the VM)
 o addMethod
  public void addMethod(Method m)
This allows more control over generating CP's for methods if you feel so inclined.

All Packages  Class Hierarchy  This Package  Previous  Next  Index