    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.

##

ClassEnv()

##

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

##

ClassEnv

      public ClassEnv()

##

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)

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)

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

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.

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.

addField

      public void addField(Var v)

write

      public void write(DataOutputStream out) throws IOException, jasError

  Write the contents of the class.
  Parameters:
    out - DataOutputStream on which the contents are written.

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

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

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

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

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)

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