org.apache.bcel.generic
public class ConstantPoolGen extends Object implements Serializable
See Also: Constant
Field Summary | |
---|---|
protected Constant[] | constants |
protected int | index |
protected int | size |
Constructor Summary | |
---|---|
ConstantPoolGen(Constant[] cs)
Initialize with given array of constants.
| |
ConstantPoolGen(ConstantPool cp)
Initialize with given constant pool. | |
ConstantPoolGen()
Create empty constant pool. |
Method Summary | |
---|---|
int | addArrayClass(ArrayType type)
Add a reference to an array class (e.g. |
int | addClass(String str)
Add a new Class reference to the ConstantPool, if it is not already in there.
|
int | addClass(ObjectType type)
Add a new Class reference to the ConstantPool for a given type.
|
int | addConstant(Constant c, ConstantPoolGen cp) Import constant from another ConstantPool and return new index. |
int | addDouble(double n)
Add a new double constant to the ConstantPool, if it is not already in there.
|
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.
|
int | addFloat(float n)
Add a new Float constant to the ConstantPool, if it is not already in there.
|
int | addInteger(int n)
Add a new Integer constant to the ConstantPool, if it is not already in there.
|
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.
|
int | addInterfaceMethodref(MethodGen method) |
int | addLong(long n)
Add a new long constant to the ConstantPool, if it is not already in there.
|
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.
|
int | addMethodref(MethodGen method) |
int | addNameAndType(String name, String signature)
Add a new NameAndType constant to the ConstantPool if it is not already
in there.
|
int | addString(String str)
Add a new String constant to the ConstantPool, if it is not already in there.
|
int | addUtf8(String n)
Add a new Utf8 constant to the ConstantPool, if it is not already in there.
|
protected void | adjustSize() Resize internal array of constants. |
Constant | getConstant(int i) |
ConstantPool | getConstantPool() |
ConstantPool | getFinalConstantPool() |
int | getSize() |
int | lookupClass(String str)
Look for ConstantClass in ConstantPool named `str'.
|
int | lookupDouble(double n)
Look for ConstantDouble in ConstantPool.
|
int | lookupFieldref(String class_name, String field_name, String signature)
Look for ConstantFieldref in ConstantPool.
|
int | lookupFloat(float n)
Look for ConstantFloat in ConstantPool.
|
int | lookupInteger(int n)
Look for ConstantInteger in ConstantPool.
|
int | lookupInterfaceMethodref(String class_name, String method_name, String signature)
Look for ConstantInterfaceMethodref in ConstantPool.
|
int | lookupInterfaceMethodref(MethodGen method) |
int | lookupLong(long n)
Look for ConstantLong in ConstantPool.
|
int | lookupMethodref(String class_name, String method_name, String signature)
Look for ConstantMethodref in ConstantPool.
|
int | lookupMethodref(MethodGen method) |
int | lookupNameAndType(String name, String signature)
Look for ConstantNameAndType in ConstantPool.
|
int | lookupString(String str)
Look for ConstantString in ConstantPool containing String `str'.
|
int | lookupUtf8(String n)
Look for ConstantUtf8 in ConstantPool.
|
void | setConstant(int i, Constant c)
Use with care!
|
String | toString() |
Parameters: cs array of given constants, new ones will be appended
Parameters: type type of array class
Returns: index of entry
Parameters: str Class to add
Returns: index of entry
Parameters: type Class to add
Returns: index of entry
Parameters: n Double number to add
Returns: index of entry
Parameters: class_name class name string to add field_name field name string to add signature signature string to add
Returns: index of entry
Parameters: n Float number to add
Returns: index of entry
Parameters: n integer number to add
Returns: index of entry
Parameters: class_name class name string to add method_name method name string to add signature signature string to add
Returns: index of entry
Parameters: n Long number to add
Returns: index of entry
Parameters: class_name class name string to add method_name method name string to add signature method signature string to add
Returns: index of entry
Parameters: name Name string to add signature signature string to add
Returns: index of entry
Parameters: str String to add
Returns: index of entry
Parameters: n Utf8 string to add
Returns: index of entry
Parameters: i index in constant pool
Returns: constant pool entry at index i
Returns: intermediate constant pool
Returns: constant pool with proper length
Returns: current size of constant pool
Parameters: str String to search for
Returns: index on success, -1 otherwise
Parameters: n Double number to look for
Returns: index on success, -1 otherwise
Parameters: class_name Where to find method field_name Guess what signature return and argument types
Returns: index on success, -1 otherwise
Parameters: n Float number to look for
Returns: index on success, -1 otherwise
Parameters: n integer number to look for
Returns: index on success, -1 otherwise
Parameters: class_name Where to find method method_name Guess what signature return and argument types
Returns: index on success, -1 otherwise
Parameters: n Long number to look for
Returns: index on success, -1 otherwise
Parameters: class_name Where to find method method_name Guess what signature return and argument types
Returns: index on success, -1 otherwise
Parameters: name of variable/method signature of variable/method
Returns: index on success, -1 otherwise
Parameters: str String to search for
Returns: index on success, -1 otherwise
Parameters: n Utf8 string to look for
Returns: index on success, -1 otherwise
Parameters: i index in constant pool c new constant pool entry at index i
Returns: String representation.