| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class is used to consequently build up a constant pool. The user adds constants via `addXXX' methods, `addString', `addClass', etc.. These methods return an index into the constant pool. Finally, `getFinalConstantPool()' returns the constant pool built up. Intermediate versions of the constant pool can be obtained with `getConstantPool()'. A constant pool has capacity for Constants.MAX_SHORT entries. Note that the first (0) is used by the JVM and that Double and Long constants need two slots entries.
Constructor Summary | |
ConstantPoolGen(Constant[] c) Initialize with given array of constants. | |
ConstantPoolGen(ConstantPool cp) Initialize with given constant pool. | |
ConstantPoolGen() Create empty constant pool. |
Method Summary | |
final int | addClass(String str) Add a new Class reference to the ConstantPool, if it is not already in there. |
final int | addConstant(Constant c) Add a given constant (without checking for double entries). |
final int | addDouble(double n) Add a new double constant to the ConstantPool, if it is not already in there. |
final int | addFieldref(String class_name, String field_name, String signature) Add a new Fieldref constant to the ConstantPool, if it is not already in there. |
final int | addFloat(float n) Add a new Float constant to the ConstantPool, if it is not already in there. |
final int | addInteger(int n) Add a new Integer constant to the ConstantPool, if it is not already in there. |
final int | addInterfaceMethodref(String class_name, String method_name, String signature) Add a new InterfaceMethodref constant to the ConstantPool, if it is not already in there. |
final int | addLong(long n) Add a new long constant to the ConstantPool, if it is not already in there. |
final int | addMethodref(String class_name, String method_name, String signature) Add a new Methodref constant to the ConstantPool, if it is not already in there. |
final int | addNameAndType(String name, String signature) Add a new NameAndType constant to the ConstantPool if it is not already in there. |
final int | addString(String str) Add a new String constant to the ConstantPool, if it is not already in there. |
final int | addUnicode(String n) Add a new Unicode constant to the ConstantPool, if it is not already in there. |
final int | addUtf8(String n) Add a new Utf8 constant to the ConstantPool, if it is not already in there. |
Constant | getConstant(int i) |
ConstantPool | getConstantPool() |
ConstantPool | getFinalConstantPool() |
int | getSize() |
final int | lookupClass(String str) Look for ConstantClass in ConstantPool named `str'. |
final int | lookupConstant(Constant c) Look up constant in ConstantPool. |
final int | lookupDouble(double n) Look for ConstantDouble in ConstantPool. |
final int | lookupFieldref(String class_name, String field_name, String signature) Look for ConstantFieldref in ConstantPool. |
final int | lookupFloat(float n) Look for ConstantFloat in ConstantPool. |
final int | lookupInteger(int n) Look for ConstantInteger in ConstantPool. |
final int | lookupInterfaceMethodref(String class_name, String method_name, String signature) Look for ConstantInterfaceMethodref in ConstantPool. |
final int | lookupLong(long n) Look for ConstantLong in ConstantPool. |
final int | lookupMethodref(String class_name, String method_name, String signature) Look for ConstantMethodref in ConstantPool. |
final int | lookupNameAndType(String name, String signature) Look for ConstantNameAndType in ConstantPool. |
final int | lookupString(String str) Look for ConstantString in ConstantPool containing String `str'. |
final int | lookupUnicode(String n) Look for ConstantUnicode in ConstantPool. |
final int | lookupUtf8(String n) Look for ConstantUtf8 in ConstantPool. |
Constructor Detail |
public ConstantPoolGen(Constant[] c)
public ConstantPoolGen(ConstantPool cp)
public ConstantPoolGen()
Method Detail |
public final int addClass(String str)
public final int addConstant(Constant c)
public final int addDouble(double n)
public final int addFieldref(String class_name, String field_name, String signature)
public final int addFloat(float n)
public final int addInteger(int n)
public final int addInterfaceMethodref(String class_name, String method_name, String signature)
public final int addLong(long n)
public final int addMethodref(String class_name, String method_name, String signature)
public final int addNameAndType(String name, String signature)
public final int addString(String str)
public final int addUnicode(String n)
public final int addUtf8(String n)
public Constant getConstant(int i)
public ConstantPool getConstantPool()
public ConstantPool getFinalConstantPool()
public int getSize()
public final int lookupClass(String str)
public final int lookupConstant(Constant c)
public final int lookupDouble(double n)
public final int lookupFieldref(String class_name, String field_name, String signature)
public final int lookupFloat(float n)
public final int lookupInteger(int n)
public final int lookupInterfaceMethodref(String class_name, String method_name, String signature)
public final int lookupLong(long n)
public final int lookupMethodref(String class_name, String method_name, String signature)
public final int lookupNameAndType(String name, String signature)
public final int lookupString(String str)
public final int lookupUnicode(String n)
public final int lookupUtf8(String n)
Association Links |
to Class jellyj.classfile.javaclass.ConstantPool
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |