com.claritysys.jvm.classfile
Class CpEntry

java.lang.Object
  extended by com.claritysys.jvm.classfile.CpEntry
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
CpClass, CpNameAndType, CpRef, CpString, CpUtf8, CpValue1, CpValue2

public abstract class CpEntry
extends java.lang.Object
implements java.lang.Cloneable

An entry in the constant pool for a ClassFile.


Field Summary
static byte TAG_CLASS
          Tag bytes, from [vmspec2 4.4].
static byte TAG_DOUBLE
           
static byte TAG_FIELDREF
           
static byte TAG_FLOAT
           
static byte TAG_INTEGER
           
static byte TAG_INTERFACE_METHODREF
           
static byte TAG_LONG
           
static byte TAG_METHODREF
           
static byte TAG_NAME_AND_TYPE
           
static byte TAG_STRING
           
static byte TAG_UTF8
           
 
Constructor Summary
CpEntry(ConstantPool pool, byte tag, int hash)
          Create a new CpEntry in the given pool, with the given hashcode.
 
Method Summary
 java.lang.Object clone()
          Clone the entry (shallow copy).
 void computeHash()
          Signal the entry to recompute (and store) its hashcode.
 int getIndex()
          Get this entry's index in the constant pool.
 byte getTag()
          Return the type of entry, one of the TAG_XXX constants, as specified in [vmspec2 4.4].
 int hashCode()
          Return the hash code of this entry.
 java.lang.String toJavaString()
          Convert the entry to a String as it would appear in a Java declaration.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_CLASS

public static final byte TAG_CLASS
Tag bytes, from [vmspec2 4.4].

See Also:
Constant Field Values

TAG_FIELDREF

public static final byte TAG_FIELDREF
See Also:
Constant Field Values

TAG_METHODREF

public static final byte TAG_METHODREF
See Also:
Constant Field Values

TAG_INTERFACE_METHODREF

public static final byte TAG_INTERFACE_METHODREF
See Also:
Constant Field Values

TAG_STRING

public static final byte TAG_STRING
See Also:
Constant Field Values

TAG_INTEGER

public static final byte TAG_INTEGER
See Also:
Constant Field Values

TAG_FLOAT

public static final byte TAG_FLOAT
See Also:
Constant Field Values

TAG_LONG

public static final byte TAG_LONG
See Also:
Constant Field Values

TAG_DOUBLE

public static final byte TAG_DOUBLE
See Also:
Constant Field Values

TAG_NAME_AND_TYPE

public static final byte TAG_NAME_AND_TYPE
See Also:
Constant Field Values

TAG_UTF8

public static final byte TAG_UTF8
See Also:
Constant Field Values
Constructor Detail

CpEntry

public CpEntry(ConstantPool pool,
               byte tag,
               int hash)
Create a new CpEntry in the given pool, with the given hashcode.

Parameters:
pool - The constant pool to which the entry is being added.
tag - The pool entry type, as one of the TAG_XXX constants.
hash - The hashcode of the entry.
Method Detail

hashCode

public final int hashCode()
Return the hash code of this entry.

Overrides:
hashCode in class java.lang.Object

computeHash

public void computeHash()
Signal the entry to recompute (and store) its hashcode.

The default does nothing.


getIndex

public final int getIndex()
Get this entry's index in the constant pool.


getTag

public final byte getTag()
Return the type of entry, one of the TAG_XXX constants, as specified in [vmspec2 4.4]. These are constants for the subclasses.


toJavaString

public java.lang.String toJavaString()
Convert the entry to a String as it would appear in a Java declaration.


clone

public java.lang.Object clone()
Clone the entry (shallow copy).

Overrides:
clone in class java.lang.Object
Returns:


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