public class ConstantPool
extends java.lang.Object
Constant| Constructor and Description |
|---|
ConstantPool()
Creates a new, empty
ConstantPool |
ConstantPool(Constant[] c)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addConstant(int tag,
java.lang.Object value)
Add a constant to the constant pool.
|
java.lang.Object |
constantAt(int idx)
Obtain the resolved value of a constant at given index in the constant
pool.
|
int |
constantIndex(int tag,
java.lang.Object value)
Get the index of the constant with the given tag and value.
|
Constant[] |
constants()
Get an array of the constants in the pool.
|
int |
constantTag(int index)
Get the tag of a constant.
|
int |
getClassIndex(java.lang.Class c)
Returns the index of the constant pool entry for the given class
|
int |
getClassIndex(Type type)
Returns the index of the constant pool entry for the given class.
|
java.util.List |
getConstantsList()
Returns an unmodifiable List of constants in this constant pool.
|
int |
getDoubleIndex(java.lang.Double d)
Returns the index of the constant pool entry for the given double
|
int |
getFloatIndex(java.lang.Float f)
Returns the index of the constant pool entry for the given float
|
int |
getIntegerIndex(java.lang.Integer i)
Returns the index of the constant pool entry for the given integer
|
int |
getLongIndex(java.lang.Long l)
Returns the index of the constant pool entry for the given long
|
int |
getMemberRefIndex(MemberRef ref)
Returns the index of the constant pool entry for the given
MemberRef |
int |
getNameAndTypeIndex(NameAndType nat)
Returns the index of the constant pool entry for the given
NameAndType |
int |
getStringIndex(java.lang.String s)
Returns the index of the constant pool entry for the given String
|
int |
getTypeIndex(Type type)
Returns the index of the constant pool entry for the given
Type |
int |
getUTF8Index(java.lang.String s)
Returns the index of the constant pool entry for the given UTF8 string
|
int |
numConstants() |
public ConstantPool(Constant[] c)
c - An array of Constant.public ConstantPool()
ConstantPoolpublic java.lang.Object constantAt(int idx)
idx - Index into the constant pool.public int numConstants()
public int constantTag(int index)
index - Index into the constant pool.public int constantIndex(int tag,
java.lang.Object value)
tag - The constant's tag (for example, Constant.UTF8).value - The constant's value (for example, a String).public int getClassIndex(java.lang.Class c)
public int getIntegerIndex(java.lang.Integer i)
public int getFloatIndex(java.lang.Float f)
public int getLongIndex(java.lang.Long l)
public int getDoubleIndex(java.lang.Double d)
public int getClassIndex(Type type)
public int getTypeIndex(Type type)
Typepublic int getStringIndex(java.lang.String s)
public int getMemberRefIndex(MemberRef ref)
MemberRefpublic int getNameAndTypeIndex(NameAndType nat)
NameAndTypepublic int getUTF8Index(java.lang.String s)
public int addConstant(int tag,
java.lang.Object value)
tag - The constant's tag (for example, Constant.UTF8).value - The constant's value (for example, a String).public Constant[] constants()
public java.util.List getConstantsList()