com.claritysys.jvm.classfile
Class CfField

java.lang.Object
  extended by com.claritysys.jvm.classfile.CfEntry
      extended by com.claritysys.jvm.classfile.CfFieldOrMethod
          extended by com.claritysys.jvm.classfile.CfField
All Implemented Interfaces:
AttributeHandler

public class CfField
extends CfFieldOrMethod
implements AttributeHandler

A field declared within a ClassFile.

Fields are organized into a linked list within our ClassFile, rather than an array, to allow for efficient dynamic growth.


Constructor Summary
CfField(ClassFile classFile)
           
 
Method Summary
 CpEntry getConstantValue()
           
 CfField getNext()
           
 CpRef getRef()
          Return a Cp(Method)Ref for invoking this method.
 boolean handleAttribute(java.io.DataInputStream dataIn, java.lang.String name, int length)
          For fields we must recognize: ConstantValue, Synthetic, Deprecated.
 void read(java.io.DataInputStream dataIn)
          Read the member from the given stream, overwriting any previous values.
 void setConstantValue(CpEntry constantValue)
           
 void setNext(CfField next)
           
 void write(java.io.DataOutput dout)
          Write the field or method to a stream in JVM classfile format.
 
Methods inherited from class com.claritysys.jvm.classfile.CfFieldOrMethod
getClassFile, getConstantPool, getDescriptorIndex, getName, getNameIndex, getSignature, isSynthetic, setDescriptorIndex, setNameIndex, setSynthetic
 
Methods inherited from class com.claritysys.jvm.classfile.CfEntry
getAccessFlags, getAttributeCount, getAttributes, isAbstract, isDeprecated, isFinal, isInterface, isNative, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, setAbstract, setAccessFlags, setAttributes, setDeprecated, setFinal, setInterface, setNative, setPrivate, setProtected, setPublic, setStatic, setStrict, setSynchronized, setTransient, setVolatile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CfField

public CfField(ClassFile classFile)
Parameters:
classFile -
Method Detail

getNext

public CfField getNext()

setNext

public void setNext(CfField next)

getConstantValue

public CpEntry getConstantValue()

setConstantValue

public void setConstantValue(CpEntry constantValue)

read

public void read(java.io.DataInputStream dataIn)
          throws java.io.IOException,
                 ClassFileFormatException
Description copied from class: CfFieldOrMethod
Read the member from the given stream, overwriting any previous values.

Subclasses must override this method, first invoking this one, and then processing attributes.

  field_info {
          u2 access_flags;
          u2 name_index;
          u2 descriptor_index;
          u2 attributes_count;
          attribute_info attributes[attributes_count];
 }

  method_info {
      u2 access_flags;
            u2 name_index;
            u2 descriptor_index;
            u2 attributes_count;
            attribute_info attributes[attributes_count];
 }
 

Overrides:
read in class CfFieldOrMethod
Throws:
java.io.IOException
ClassFileFormatException

handleAttribute

public boolean handleAttribute(java.io.DataInputStream dataIn,
                               java.lang.String name,
                               int length)
                        throws java.io.IOException,
                               ClassFileFormatException
For fields we must recognize: ConstantValue, Synthetic, Deprecated.

Specified by:
handleAttribute in interface AttributeHandler
Parameters:
dataIn - DataInputStream, positioned to attribute's data.
name - Attribute name from constant pool.
length - Length of info[] in bytes.
Returns:
true if the handler processed it, false if not.
Throws:
java.io.IOException - If an I/O error ocurrs.
ClassFileFormatException - If the attribute was processed but was incorrectly formed.

write

public void write(java.io.DataOutput dout)
           throws java.io.IOException
Description copied from class: CfFieldOrMethod
Write the field or method to a stream in JVM classfile format.

Subclasses must override this and extend the behavior by writing the attribute table.

Overrides:
write in class CfFieldOrMethod
Throws:
java.io.IOException

getRef

public CpRef getRef()
Return a Cp(Method)Ref for invoking this method.



Copyright ? 2000-2003 Clarity Systems Group, LLC. All Rights Reserved.