Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.chaoswg.xtc4y.classdesc
Class ClassDescriptor  view ClassDescriptor download ClassDescriptor.java

java.lang.Object
  extended bycom.chaoswg.xtc4y.classdesc.ClassDescriptor

public class ClassDescriptor
extends java.lang.Object

This container class represents the content of a class file in a readable and reditable way. For further informations about the java class fiel format, see the Java Virtual Machine Specification §4. All mentioned references refere to the chapters and subchapters in this book.


Field Summary
private  java.util.Vector attributes
           
private  ClassAccessFlags classAccess
           
private  java.util.Vector fields
           
private  java.util.Vector interfaces
           
static int MAGIC_NUMBER
          Every class has to begin with this magic number
private  short majorVersion
           
private  java.util.Vector methods
           
private  short minorVersion
           
private  ClassCPEntry superClass
           
private  ClassCPEntry thisClass
           
 
Constructor Summary
ClassDescriptor()
          Construct a new initial classDescriptor
ClassDescriptor(java.io.DataInputStream dis)
          Construct a new ClassDescriptor and intialize it reading from a DataInputstream
 
Method Summary
 void addAttribute(AttributeInfo attribute)
          Add an attribute to this class
 void addField(FieldInfo field)
          Add a field to this class
 void addInterface(InterfaceInfo ifc)
          Add an interface
 void addMethod(MethodInfo method)
          Add a method to this class
 AttributeInfo[] getAttributes()
           
 ClassAccessFlags getClassAccessFlags()
           
 FieldInfo[] getFields()
           
 InterfaceInfo[] getInterfaces()
           
 short getMajorVersion()
           
 MethodInfo[] getMethods()
           
 short getMinorVersion()
           
 ClassCPEntry getSuperClass()
           
 ClassCPEntry getThisClass()
           
 void initialize(java.io.DataInputStream dis)
          Initialize a ClassDescriptor by reading from a DataInputStream
 void removeAttribute(AttributeInfo attribute)
          Remove an attribute from the current class
 void removeField(FieldInfo field)
          Remove a Field from the current class
 void removeInterface(InterfaceInfo ifc)
          Remove an interface
 void removeMethod(MethodInfo method)
          Remove a Method from the current class
protected  void reset()
          reset all variables to default values
 void setClassAccess(ClassAccessFlags flags)
          set the classAccessFlag
 void setMajorVersion(short major)
          Set the major version
 void setMinorVersion(short minor)
          Set the minor version
 void setSuperClass(ClassCPEntry cl)
          Set the super class, null if no super class is present
 void setThisClass(ClassCPEntry cl)
          Set the class
 java.lang.String toString()
          Print the class descriptor in a readable way
 void writeClass(java.io.DataOutputStream dos)
          Print the class onto a DataOutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAGIC_NUMBER

public static final int MAGIC_NUMBER
Every class has to begin with this magic number

See Also:
Constant Field Values

minorVersion

private short minorVersion

majorVersion

private short majorVersion

classAccess

private ClassAccessFlags classAccess

thisClass

private ClassCPEntry thisClass

superClass

private ClassCPEntry superClass

interfaces

private java.util.Vector interfaces

fields

private java.util.Vector fields

methods

private java.util.Vector methods

attributes

private java.util.Vector attributes
Constructor Detail

ClassDescriptor

public ClassDescriptor()
Construct a new initial classDescriptor


ClassDescriptor

public ClassDescriptor(java.io.DataInputStream dis)
                throws java.io.IOException
Construct a new ClassDescriptor and intialize it reading from a DataInputstream

Method Detail

reset

protected void reset()
reset all variables to default values


initialize

public void initialize(java.io.DataInputStream dis)
                throws java.io.IOException
Initialize a ClassDescriptor by reading from a DataInputStream


writeClass

public void writeClass(java.io.DataOutputStream dos)
                throws java.io.IOException
Print the class onto a DataOutputStream


setMinorVersion

public void setMinorVersion(short minor)
Set the minor version


getMinorVersion

public short getMinorVersion()

setMajorVersion

public void setMajorVersion(short major)
Set the major version


getMajorVersion

public short getMajorVersion()

setClassAccess

public void setClassAccess(ClassAccessFlags flags)
set the classAccessFlag


getClassAccessFlags

public ClassAccessFlags getClassAccessFlags()

setThisClass

public void setThisClass(ClassCPEntry cl)
Set the class


getThisClass

public ClassCPEntry getThisClass()

setSuperClass

public void setSuperClass(ClassCPEntry cl)
Set the super class, null if no super class is present


getSuperClass

public ClassCPEntry getSuperClass()

addInterface

public void addInterface(InterfaceInfo ifc)
Add an interface


getInterfaces

public InterfaceInfo[] getInterfaces()

removeInterface

public void removeInterface(InterfaceInfo ifc)
Remove an interface


addField

public void addField(FieldInfo field)
Add a field to this class


getFields

public FieldInfo[] getFields()

removeField

public void removeField(FieldInfo field)
Remove a Field from the current class


addMethod

public void addMethod(MethodInfo method)
Add a method to this class


getMethods

public MethodInfo[] getMethods()

removeMethod

public void removeMethod(MethodInfo method)
Remove a Method from the current class


addAttribute

public void addAttribute(AttributeInfo attribute)
Add an attribute to this class


getAttributes

public AttributeInfo[] getAttributes()

removeAttribute

public void removeAttribute(AttributeInfo attribute)
Remove an attribute from the current class


toString

public java.lang.String toString()
Print the class descriptor in a readable way