javar.fields
Class Field

java.lang.Object
  |
  +--javar.fields.Field

public class Field
extends Object

This class represents a field in a class

Author:
Ben Litchfield

Constructor Summary
Field(ConstantPool p)
          Constructor
 
Method Summary
 int getAccessFlags()
          This will get the access flags for this field.
 ConstantPoolEntry getConstantValue()
          If this field is final then it may have a constant value that is associated with it.
 String getNameAsString()
          This will get the name of this field as a String.
 int getType()
          This will get the type of this field.
 String getTypeAsString()
          This will get the type of this field as a String.
 void load(DataInputStream in)
          This will load the data necessary to have a field
 void setAccessFlags(int flags)
          This will set the access flags for this field.
 void setType(int type)
          This will set the type for this field.
 byte[] toBytes()
          This will convert this field into an array of bytes that go in the bytes of a class file
 String toString()
          This will print the field
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Field

public Field(ConstantPool p)
Constructor

Method Detail

getAccessFlags

public int getAccessFlags()
This will get the access flags for this field.

Returns:
the access flags for this field

setAccessFlags

public void setAccessFlags(int flags)
This will set the access flags for this field.

Parameters:
flags - The new access flags for this field

getType

public int getType()
This will get the type of this field.

Returns:
The type for this field.

getTypeAsString

public String getTypeAsString()
                       throws JavarParseException
This will get the type of this field as a String.

Returns:
The class name for this field
Throws:
JavarParseException - If there is an exception while parsing the type

getNameAsString

public String getNameAsString()
This will get the name of this field as a String.

Returns:
The name for this field

setType

public void setType(int type)
This will set the type for this field.


getConstantValue

public ConstantPoolEntry getConstantValue()
If this field is final then it may have a constant value that is associated with it. The will return the pool entry that this field points to if possible.

Returns:
The constant value associated with this field or null if no constant value was associated with it.

toBytes

public byte[] toBytes()
               throws IOException
This will convert this field into an array of bytes that go in the bytes of a class file

IOException

load

public void load(DataInputStream in)
This will load the data necessary to have a field

Parameters:
in - the input stream to load the data from

toString

public String toString()
This will print the field

Overrides:
toString in class Object