edu.rice.cs.cunit.classFile
Class FieldInfo

java.lang.Object
  extended by edu.rice.cs.cunit.classFile.FieldInfo

public final class FieldInfo
extends java.lang.Object

Represents a field in a class file.

Author:
Mathias Ricken

Field Summary
private  short _accessFlags
          Field access flags
private  java.util.ArrayList<AAttributeInfo> _attributes
          Attributes.
private  AUTFPoolInfo _descriptor
          Type descriptor information.
private  AUTFPoolInfo _name
          Name information.
 
Constructor Summary
FieldInfo(java.io.DataInputStream di, ConstantPool pool)
          Constructor.
FieldInfo(short accessFlags, AUTFPoolInfo name, AUTFPoolInfo descriptor, SourceFileAttributeInfo[] attributes)
          Constructor.
 
Method Summary
 short getAccessFlags()
          Accessor for access flags.
 AAttributeInfo getAttribute(java.lang.String name)
          Return the attribute with the specified name.
 java.util.ArrayList<AAttributeInfo> getAttributes()
          Accessor for attributes.
 AUTFPoolInfo getDescriptor()
          Accessor for descriptor.
 AUTFPoolInfo getName()
          Accessor for field name.
 void setAccessFlags(short accessFlags)
          Mutator for access flags.
 void setAttributes(java.util.ArrayList<AAttributeInfo> attributes)
          Mutator for attributes.
 void setDescriptor(AUTFPoolInfo descriptor)
          Mutator for descriptor.
 void setName(AUTFPoolInfo name)
          Mutator for field name.
 java.lang.String toString()
          Return a human-readable version of this field.
 java.lang.String toString(ConstantPool pool)
          Return a human-readable version of this field and correctly handle booleans and strings.
 void write(java.io.DataOutputStream dos, ConstantPool pool)
          Write this field into a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_accessFlags

private short _accessFlags
Field access flags


_name

private AUTFPoolInfo _name
Name information.


_descriptor

private AUTFPoolInfo _descriptor
Type descriptor information.


_attributes

private java.util.ArrayList<AAttributeInfo> _attributes
Attributes.

Constructor Detail

FieldInfo

public FieldInfo(short accessFlags,
                 AUTFPoolInfo name,
                 AUTFPoolInfo descriptor,
                 SourceFileAttributeInfo[] attributes)
Constructor.

Parameters:
accessFlags - field access flags
name - field name
descriptor - field descriptor
attributes - array of attributes

FieldInfo

public FieldInfo(java.io.DataInputStream di,
                 ConstantPool pool)
          throws java.io.IOException,
                 java.lang.ClassFormatError
Constructor.

Parameters:
di - input stream
pool - constant pool
Throws:
java.io.IOException
java.lang.ClassFormatError
Method Detail

write

public void write(java.io.DataOutputStream dos,
                  ConstantPool pool)
           throws java.io.IOException
Write this field into a stream.

Parameters:
dos - output stream
pool - constant pool
Throws:
java.io.IOException

toString

public java.lang.String toString()
Return a human-readable version of this field.

Overrides:
toString in class java.lang.Object
Returns:
string

toString

public final java.lang.String toString(ConstantPool pool)
Return a human-readable version of this field and correctly handle booleans and strings.

Parameters:
pool - constant pool
Returns:
string

getAccessFlags

public short getAccessFlags()
Accessor for access flags.

Returns:
access flags

setAccessFlags

public void setAccessFlags(short accessFlags)
Mutator for access flags.

Parameters:
accessFlags - new access flags

getName

public AUTFPoolInfo getName()
Accessor for field name.

Returns:
field name

setName

public void setName(AUTFPoolInfo name)
Mutator for field name.

Parameters:
name - new field name

getDescriptor

public AUTFPoolInfo getDescriptor()
Accessor for descriptor.

Returns:
descriptor

setDescriptor

public void setDescriptor(AUTFPoolInfo descriptor)
Mutator for descriptor.

Parameters:
descriptor - new descriptor

getAttributes

public java.util.ArrayList<AAttributeInfo> getAttributes()
Accessor for attributes.

Returns:
attributes

getAttribute

public AAttributeInfo getAttribute(java.lang.String name)
Return the attribute with the specified name.

Parameters:
name - attribute name
Returns:
attribute or null if not found

setAttributes

public void setAttributes(java.util.ArrayList<AAttributeInfo> attributes)
Mutator for attributes.

Parameters:
attributes - new attributes