javassist.bytecode
public final class ConstPool extends Object
| Field Summary | |
|---|---|
| static int | CONST_ClassCONSTANT_Class |
| static int | CONST_DoubleCONSTANT_Double |
| static int | CONST_FieldrefCONSTANT_Fieldref |
| static int | CONST_FloatCONSTANT_Float |
| static int | CONST_IntegerCONSTANT_Integer |
| static int | CONST_InterfaceMethodrefCONSTANT_InterfaceMethodref |
| static int | CONST_LongCONSTANT_Long |
| static int | CONST_MethodrefCONSTANT_Methodref |
| static int | CONST_NameAndTypeCONSTANT_NameAndType |
| static int | CONST_StringCONSTANT_String |
| static int | CONST_Utf8CONSTANT_Utf8 |
| static CtClass | THIS
Represents the class using this constant pool table. |
| Constructor Summary | |
|---|---|
| ConstPool(String thisclass)
Constructs a constant pool table.
| |
| ConstPool(DataInputStream in)
Constructs a constant pool table from the given byte stream.
| |
| Method Summary | |
|---|---|
| int | addClassInfo(CtClass c)
Adds a new CONSTANT_Class_info structure.
|
| int | addClassInfo(String qname)
Adds a new CONSTANT_Class_info structure.
|
| int | addDoubleInfo(double d)
Adds a new CONSTANT_Double_info
structure.
|
| int | addFieldrefInfo(int classInfo, String name, String type)
Adds a new CONSTANT_Fieldref_info structure.
|
| int | addFieldrefInfo(int classInfo, int nameAndTypeInfo)
Adds a new CONSTANT_Fieldref_info structure.
|
| int | addFloatInfo(float f)
Adds a new CONSTANT_Float_info
structure.
|
| int | addIntegerInfo(int i)
Adds a new CONSTANT_Integer_info
structure.
|
| int | addInterfaceMethodrefInfo(int classInfo, String name, String type)
Adds a new CONSTANT_InterfaceMethodref_info
structure.
|
| int | addInterfaceMethodrefInfo(int classInfo, int nameAndTypeInfo)
Adds a new CONSTANT_InterfaceMethodref_info
structure.
|
| int | addLongInfo(long l)
Adds a new CONSTANT_Long_info
structure.
|
| int | addMethodrefInfo(int classInfo, String name, String type)
Adds a new CONSTANT_Methodref_info structure.
|
| int | addMethodrefInfo(int classInfo, int nameAndTypeInfo)
Adds a new CONSTANT_Methodref_info structure.
|
| int | addNameAndTypeInfo(String name, String type)
Adds a new CONSTANT_NameAndType_info structure.
|
| int | addNameAndTypeInfo(int name, int type)
Adds a new CONSTANT_NameAndType_info structure.
|
| int | addStringInfo(String str)
Adds a new CONSTANT_String_info
structure.
|
| int | addUtf8Info(String utf8)
Adds a new CONSTANT_Utf8_info
structure.
|
| int | copy(int n, ConstPool dest, Map classnames)
Copies the n-th item in this ConstPool object into the destination
ConstPool object.
|
| String | getClassInfo(int index)
Reads CONSTANT_Class_info structure
at the given index.
|
| String | getClassName()
Returns the name of the class using this constant pool table. |
| Set | getClassNames()
Get all the class names.
|
| double | getDoubleInfo(int index)
Reads CONSTANT_Double_info structure
at the given index.
|
| int | getFieldrefClass(int index)
Reads the class_index field of the
CONSTANT_Fieldref_info structure
at the given index. |
| String | getFieldrefClassName(int index)
Reads the class_index field of the
CONSTANT_Fieldref_info structure
at the given index.
|
| String | getFieldrefName(int index)
Reads the name_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
|
| int | getFieldrefNameAndType(int index)
Reads the name_and_type_index field of the
CONSTANT_Fieldref_info structure
at the given index. |
| String | getFieldrefType(int index)
Reads the descriptor_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
|
| float | getFloatInfo(int index)
Reads CONSTANT_Float_info structure
at the given index.
|
| int | getIntegerInfo(int index)
Reads CONSTANT_Integer_info structure
at the given index.
|
| int | getInterfaceMethodrefClass(int index)
Reads the class_index field of the
CONSTANT_InterfaceMethodref_info structure
at the given index. |
| String | getInterfaceMethodrefClassName(int index)
Reads the class_index field of the
CONSTANT_InterfaceMethodref_info structure
at the given index.
|
| String | getInterfaceMethodrefName(int index)
Reads the name_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
|
| int | getInterfaceMethodrefNameAndType(int index)
Reads the name_and_type_index field of the
CONSTANT_InterfaceMethodref_info structure
at the given index. |
| String | getInterfaceMethodrefType(int index)
Reads the descriptor_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
|
| Object | getLdcValue(int index)
Reads CONSTANT_Integer_info, _Float_info,
_Long_info, _Double_info, or
_String_info structure.
|
| long | getLongInfo(int index)
Reads CONSTANT_Long_info structure
at the given index.
|
| int | getMethodrefClass(int index)
Reads the class_index field of the
CONSTANT_Methodref_info structure
at the given index. |
| String | getMethodrefClassName(int index)
Reads the class_index field of the
CONSTANT_Methodref_info structure
at the given index.
|
| String | getMethodrefName(int index)
Reads the name_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
|
| int | getMethodrefNameAndType(int index)
Reads the name_and_type_index field of the
CONSTANT_Methodref_info structure
at the given index. |
| String | getMethodrefType(int index)
Reads the descriptor_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
|
| int | getNameAndTypeDescriptor(int index)
Reads the descriptor_index field of the
CONSTANT_NameAndType_info structure
at the given index. |
| int | getNameAndTypeName(int index)
Reads the name_index field of the
CONSTANT_NameAndType_info structure
at the given index. |
| int | getSize()
Returns the number of entries in this table. |
| String | getStringInfo(int index)
Reads CONSTANT_String_info structure
at the given index.
|
| int | getTag(int index)
Returns the tag field of the constant pool table
entry at the given index. |
| int | getThisClassInfo()
Returns the index of CONSTANT_Class_info structure
specifying the class using this constant pool table. |
| String | getUtf8Info(int index)
Reads CONSTANT_utf8_info structure
at the given index.
|
| int | isConstructor(String classname, int index)
Determines whether CONSTANT_Methodref_info
structure at the given index represents the constructor
of the given class.
|
| int | isMember(String classname, String membername, int index)
Determines whether CONSTANT_Methodref_info,
CONSTANT_Fieldref_info, or
CONSTANT_InterfaceMethodref_info structure
at the given index represents the member with the specified
name and declaring class.
|
| void | print()
Prints the contents of the constant pool table. |
| void | print(PrintWriter out)
Prints the contents of the constant pool table. |
| void | renameClass(String oldName, String newName)
Replaces all occurrences of a class name.
|
| void | renameClass(Map classnames)
Replaces all occurrences of class names.
|
| void | write(DataOutputStream out)
Writes the contents of the constant pool table. |
CONSTANT_ClassCONSTANT_DoubleCONSTANT_FieldrefCONSTANT_FloatCONSTANT_IntegerCONSTANT_InterfaceMethodrefCONSTANT_LongCONSTANT_MethodrefCONSTANT_NameAndTypeCONSTANT_StringCONSTANT_Utf8Parameters: thisclass the name of the class using this constant pool table
Parameters: in byte stream.
CONSTANT_Class_info structure.
This also adds a CONSTANT_Utf8_info structure
for storing the class name.
Returns: the index of the added entry.
CONSTANT_Class_info structure.
This also adds a CONSTANT_Utf8_info structure
for storing the class name.
Parameters: qname a fully-qualified class name (or the JVM-internal representation of that name).
Returns: the index of the added entry.
CONSTANT_Double_info
structure.
Returns: the index of the added entry.
CONSTANT_Fieldref_info structure.
This also adds a new CONSTANT_NameAndType_info
structure.
Parameters: classInfo class_index name name_index
of CONSTANT_NameAndType_info. type descriptor_index
of CONSTANT_NameAndType_info.
Returns: the index of the added entry.
CONSTANT_Fieldref_info structure.
Parameters: classInfo class_index nameAndTypeInfo name_and_type_index.
Returns: the index of the added entry.
CONSTANT_Float_info
structure.
Returns: the index of the added entry.
CONSTANT_Integer_info
structure.
Returns: the index of the added entry.
CONSTANT_InterfaceMethodref_info
structure.
This also adds a new CONSTANT_NameAndType_info
structure.
Parameters: classInfo class_index name name_index
of CONSTANT_NameAndType_info. type descriptor_index
of CONSTANT_NameAndType_info.
Returns: the index of the added entry.
CONSTANT_InterfaceMethodref_info
structure.
Parameters: classInfo class_index nameAndTypeInfo name_and_type_index.
Returns: the index of the added entry.
CONSTANT_Long_info
structure.
Returns: the index of the added entry.
CONSTANT_Methodref_info structure.
This also adds a new CONSTANT_NameAndType_info
structure.
Parameters: classInfo class_index name name_index
of CONSTANT_NameAndType_info. type descriptor_index
of CONSTANT_NameAndType_info.
Returns: the index of the added entry.
CONSTANT_Methodref_info structure.
Parameters: classInfo class_index nameAndTypeInfo name_and_type_index.
Returns: the index of the added entry.
CONSTANT_NameAndType_info structure.
This also adds CONSTANT_Utf8_info structures.
Parameters: name name_index type descriptor_index
Returns: the index of the added entry.
CONSTANT_NameAndType_info structure.
Parameters: name name_index type descriptor_index
Returns: the index of the added entry.
CONSTANT_String_info
structure.
This also adds a new CONSTANT_Utf8_info
structure.
Returns: the index of the added entry.
CONSTANT_Utf8_info
structure.
If the given utf8 string has been already recorded in the table, then this method does not add a new entry to avoid adding a duplicated entry. Instead, it returns the index of the entry already recorded.
Returns: the index of the added entry.
Parameters: n the n-th item dest destination constant pool table classnames the map or null.
Returns: the index of the copied item into the destination ClassPool.
CONSTANT_Class_info structure
at the given index.
Returns: a fully-qualified class or interface name specified
by name_index.
Returns: a set of class names
CONSTANT_Double_info structure
at the given index.
Returns: the value specified by this entry.
class_index field of the
CONSTANT_Fieldref_info structure
at the given index.class_index field of the
CONSTANT_Fieldref_info structure
at the given index.
Returns: the name of the class at that class_index.
name_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
Parameters: index an index to a CONSTANT_Fieldref_info.
Returns: the name of the field.
name_and_type_index field of the
CONSTANT_Fieldref_info structure
at the given index.descriptor_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
Parameters: index an index to a CONSTANT_Fieldref_info.
Returns: the type descriptor of the field.
CONSTANT_Float_info structure
at the given index.
Returns: the value specified by this entry.
CONSTANT_Integer_info structure
at the given index.
Returns: the value specified by this entry.
class_index field of the
CONSTANT_InterfaceMethodref_info structure
at the given index.class_index field of the
CONSTANT_InterfaceMethodref_info structure
at the given index.
Returns: the name of the class at that class_index.
name_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
Parameters: index an index to
a CONSTANT_InterfaceMethodref_info.
Returns: the name of the method.
name_and_type_index field of the
CONSTANT_InterfaceMethodref_info structure
at the given index.descriptor_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
Parameters: index an index to
a CONSTANT_InterfaceMethodref_info.
Returns: the descriptor of the method.
CONSTANT_Integer_info, _Float_info,
_Long_info, _Double_info, or
_String_info structure.
These are used with the LDC instruction.
Returns: a String value or a wrapped primitive-type
value.
CONSTANT_Long_info structure
at the given index.
Returns: the value specified by this entry.
class_index field of the
CONSTANT_Methodref_info structure
at the given index.class_index field of the
CONSTANT_Methodref_info structure
at the given index.
Returns: the name of the class at that class_index.
name_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
Parameters: index an index to a CONSTANT_Methodref_info.
Returns: the name of the method.
name_and_type_index field of the
CONSTANT_Methodref_info structure
at the given index.descriptor_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index.
Parameters: index an index to a CONSTANT_Methodref_info.
Returns: the descriptor of the method.
descriptor_index field of the
CONSTANT_NameAndType_info structure
at the given index.name_index field of the
CONSTANT_NameAndType_info structure
at the given index.CONSTANT_String_info structure
at the given index.
Returns: the string specified by string_index.
tag field of the constant pool table
entry at the given index.CONSTANT_Class_info structure
specifying the class using this constant pool table.CONSTANT_utf8_info structure
at the given index.
Returns: the string specified by this entry.
CONSTANT_Methodref_info
structure at the given index represents the constructor
of the given class.
Returns: the descriptor_index specifying
the type descriptor of the that constructor.
If it is not that constructor,
isConstructor() returns 0.
CONSTANT_Methodref_info,
CONSTANT_Fieldref_info, or
CONSTANT_InterfaceMethodref_info structure
at the given index represents the member with the specified
name and declaring class.
Parameters: classname the class declaring the member membername the member name index the index into the constant pool table
Returns: the descriptor_index specifying
the type descriptor of that member.
If it is not that member,
isMember() returns 0.
Parameters: oldName the replaced name (JVM-internal representation). newName the substituted name (JVM-internal representation).
Parameters: classnames specifies pairs of replaced and substituted name.