|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectclassUtils.javassist.bytecode.ConstPool
public final class ConstPool
Constant pool table.
Field Summary | |
---|---|
static int |
CONST_Class
CONSTANT_Class |
static int |
CONST_Double
CONSTANT_Double |
static int |
CONST_Fieldref
CONSTANT_Fieldref |
static int |
CONST_Float
CONSTANT_Float |
static int |
CONST_Integer
CONSTANT_Integer |
static int |
CONST_InterfaceMethodref
CONSTANT_InterfaceMethodref |
static int |
CONST_Long
CONSTANT_Long |
static int |
CONST_Methodref
CONSTANT_Methodref |
static int |
CONST_NameAndType
CONSTANT_NameAndType |
static int |
CONST_String
CONSTANT_String |
static int |
CONST_Utf8
CONSTANT_Utf8 |
static CompileTimeClass |
THIS
Represents the class using this constant pool table. |
Constructor Summary | |
---|---|
ConstPool(java.io.DataInputStream in)
Constructs a constant pool table from the given byte stream. |
|
ConstPool(java.lang.String thisclass)
Constructs a constant pool table. |
Method Summary | |
---|---|
int |
addClassInfo(CompileTimeClass c)
Adds a new CONSTANT_Class_info structure. |
int |
addClassInfo(java.lang.String qname)
Adds a new CONSTANT_Class_info structure. |
int |
addDoubleInfo(double d)
Adds a new CONSTANT_Double_info
structure. |
int |
addFieldrefInfo(int classInfo,
int nameAndTypeInfo)
Adds a new CONSTANT_Fieldref_info structure. |
int |
addFieldrefInfo(int classInfo,
java.lang.String name,
java.lang.String type)
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,
int nameAndTypeInfo)
Adds a new CONSTANT_InterfaceMethodref_info
structure. |
int |
addInterfaceMethodrefInfo(int classInfo,
java.lang.String name,
java.lang.String type)
Adds a new CONSTANT_InterfaceMethodref_info
structure. |
int |
addLongInfo(long l)
Adds a new CONSTANT_Long_info
structure. |
int |
addMethodrefInfo(int classInfo,
int nameAndTypeInfo)
Adds a new CONSTANT_Methodref_info structure. |
int |
addMethodrefInfo(int classInfo,
java.lang.String name,
java.lang.String type)
Adds a new CONSTANT_Methodref_info structure. |
int |
addNameAndTypeInfo(int name,
int type)
Adds a new CONSTANT_NameAndType_info structure. |
int |
addNameAndTypeInfo(java.lang.String name,
java.lang.String type)
Adds a new CONSTANT_NameAndType_info structure. |
int |
addStringInfo(java.lang.String str)
Adds a new CONSTANT_String_info
structure. |
int |
addUtf8Info(java.lang.String utf8)
Adds a new CONSTANT_Utf8_info
structure. |
int |
copy(int n,
ConstPool dest,
java.util.Map classnames)
Copies the n-th item in this ConstPool object into the destination ConstPool object. |
java.lang.String |
getClassInfo(int index)
Reads CONSTANT_Class_info structure
affineTransform the given index. |
java.lang.String |
getClassName()
Returns the name of the class using this constant pool table. |
double |
getDoubleInfo(int index)
Reads CONSTANT_Double_info structure
affineTransform the given index. |
int |
getFieldrefClass(int index)
Reads the class_index field of the
CONSTANT_Fieldref_info structure
affineTransform the given index. |
java.lang.String |
getFieldrefClassName(int index)
Reads the class_index field of the
CONSTANT_Fieldref_info structure
affineTransform the given index. |
java.lang.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
affineTransform the given index. |
java.lang.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
affineTransform the given index. |
int |
getIntegerInfo(int index)
Reads CONSTANT_Integer_info structure
affineTransform the given index. |
int |
getInterfaceMethodrefClass(int index)
Reads the class_index field of the
CONSTANT_InterfaceMethodref_info structure
affineTransform the given index. |
java.lang.String |
getInterfaceMethodrefClassName(int index)
Reads the class_index field of the
CONSTANT_InterfaceMethodref_info structure
affineTransform the given index. |
java.lang.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
affineTransform the given index. |
java.lang.String |
getInterfaceMethodrefType(int index)
Reads the descriptor_index field of the
CONSTANT_NameAndType_info structure
indirectly specified by the given index. |
java.lang.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
affineTransform the given index. |
int |
getMethodrefClass(int index)
Reads the class_index field of the
CONSTANT_Methodref_info structure
affineTransform the given index. |
java.lang.String |
getMethodrefClassName(int index)
Reads the class_index field of the
CONSTANT_Methodref_info structure
affineTransform the given index. |
java.lang.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
affineTransform the given index. |
java.lang.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
affineTransform the given index. |
int |
getNameAndTypeName(int index)
Reads the name_index field of the
CONSTANT_NameAndType_info structure
affineTransform the given index. |
java.lang.String |
getStringInfo(int index)
Reads CONSTANT_String_info structure
affineTransform the given index. |
int |
getTag(int index)
Returns the tag field of the constant pool table
entry affineTransform the given index. |
int |
getThisClassInfo()
Returns the index of CONSTANT_Class_info structure
specifying the class using this constant pool table. |
java.lang.String |
getUtf8Info(int index)
Reads CONSTANT_utf8_info structure
affineTransform the given index. |
int |
isConstructor(java.lang.String classname,
int index)
Determines whether CONSTANT_Methodref_info
structure affineTransform the given index represents the constructor
of the given class. |
int |
isMember(java.lang.String classname,
java.lang.String membername,
int index)
Determines whether CONSTANT_Methodref_info ,
CONSTANT_Fieldref_info , or
CONSTANT_InterfaceMethodref_info structure
affineTransform 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(java.io.PrintWriter out)
Prints the contents of the constant pool table. |
void |
renameClass(java.util.Map classnames)
Replaces all occurrences of class names. |
void |
renameClass(java.lang.String oldName,
java.lang.String newName)
Replaces all occurrences of a class name. |
void |
write(java.io.DataOutputStream out)
Writes the contents of the constant pool table. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CONST_Class
CONSTANT_Class
public static final int CONST_Fieldref
CONSTANT_Fieldref
public static final int CONST_Methodref
CONSTANT_Methodref
public static final int CONST_InterfaceMethodref
CONSTANT_InterfaceMethodref
public static final int CONST_String
CONSTANT_String
public static final int CONST_Integer
CONSTANT_Integer
public static final int CONST_Float
CONSTANT_Float
public static final int CONST_Long
CONSTANT_Long
public static final int CONST_Double
CONSTANT_Double
public static final int CONST_NameAndType
CONSTANT_NameAndType
public static final int CONST_Utf8
CONSTANT_Utf8
public static final CompileTimeClass THIS
Constructor Detail |
---|
public ConstPool(java.lang.String thisclass)
thisclass
- the name of the class using this constant
pool tablepublic ConstPool(java.io.DataInputStream in) throws java.io.IOException
in
- byte stream.
java.io.IOException
Method Detail |
---|
public java.lang.String getClassName()
public int getThisClassInfo()
CONSTANT_Class_info
structure
specifying the class using this constant pool table.
public int getTag(int index)
tag
field of the constant pool table
entry affineTransform the given index.
public java.lang.String getClassInfo(int index)
CONSTANT_Class_info
structure
affineTransform the given index.
name_index
.public int getNameAndTypeName(int index)
name_index
field of the
CONSTANT_NameAndType_info
structure
affineTransform the given index.
public int getNameAndTypeDescriptor(int index)
descriptor_index
field of the
CONSTANT_NameAndType_info
structure
affineTransform the given index.
public int getFieldrefClass(int index)
class_index
field of the
CONSTANT_Fieldref_info
structure
affineTransform the given index.
public java.lang.String getFieldrefClassName(int index)
class_index
field of the
CONSTANT_Fieldref_info
structure
affineTransform the given index.
class_index
.public int getFieldrefNameAndType(int index)
name_and_type_index
field of the
CONSTANT_Fieldref_info
structure
affineTransform the given index.
public java.lang.String getFieldrefName(int index)
name_index
field of the
CONSTANT_NameAndType_info
structure
indirectly specified by the given index.
index
- an index to a CONSTANT_Fieldref_info
.
public java.lang.String getFieldrefType(int index)
descriptor_index
field of the
CONSTANT_NameAndType_info
structure
indirectly specified by the given index.
index
- an index to a CONSTANT_Fieldref_info
.
public int getMethodrefClass(int index)
class_index
field of the
CONSTANT_Methodref_info
structure
affineTransform the given index.
public java.lang.String getMethodrefClassName(int index)
class_index
field of the
CONSTANT_Methodref_info
structure
affineTransform the given index.
class_index
.public int getMethodrefNameAndType(int index)
name_and_type_index
field of the
CONSTANT_Methodref_info
structure
affineTransform the given index.
public java.lang.String getMethodrefName(int index)
name_index
field of the
CONSTANT_NameAndType_info
structure
indirectly specified by the given index.
index
- an index to a CONSTANT_Methodref_info
.
public java.lang.String getMethodrefType(int index)
descriptor_index
field of the
CONSTANT_NameAndType_info
structure
indirectly specified by the given index.
index
- an index to a CONSTANT_Methodref_info
.
public int getInterfaceMethodrefClass(int index)
class_index
field of the
CONSTANT_InterfaceMethodref_info
structure
affineTransform the given index.
public java.lang.String getInterfaceMethodrefClassName(int index)
class_index
field of the
CONSTANT_InterfaceMethodref_info
structure
affineTransform the given index.
class_index
.public int getInterfaceMethodrefNameAndType(int index)
name_and_type_index
field of the
CONSTANT_InterfaceMethodref_info
structure
affineTransform the given index.
public java.lang.String getInterfaceMethodrefName(int index)
name_index
field of the
CONSTANT_NameAndType_info
structure
indirectly specified by the given index.
index
- an index to
a CONSTANT_InterfaceMethodref_info
.
public java.lang.String getInterfaceMethodrefType(int index)
descriptor_index
field of the
CONSTANT_NameAndType_info
structure
indirectly specified by the given index.
index
- an index to
a CONSTANT_InterfaceMethodref_info
.
public java.lang.Object getLdcValue(int index)
CONSTANT_Integer_info
, _Float_info
,
_Long_info
, _Double_info
, or
_String_info
structure.
These are used with the LDC instruction.
String
value or a wrapped primitive-type
value.public int getIntegerInfo(int index)
CONSTANT_Integer_info
structure
affineTransform the given index.
public float getFloatInfo(int index)
CONSTANT_Float_info
structure
affineTransform the given index.
public long getLongInfo(int index)
CONSTANT_Long_info
structure
affineTransform the given index.
public double getDoubleInfo(int index)
CONSTANT_Double_info
structure
affineTransform the given index.
public java.lang.String getStringInfo(int index)
CONSTANT_String_info
structure
affineTransform the given index.
string_index
.public java.lang.String getUtf8Info(int index)
CONSTANT_utf8_info
structure
affineTransform the given index.
public int isConstructor(java.lang.String classname, int index)
CONSTANT_Methodref_info
structure affineTransform the given index represents the constructor
of the given class.
descriptor_index
specifying
the type descriptor of the that constructor.
If it is not that constructor,
isConstructor()
returns 0.public int isMember(java.lang.String classname, java.lang.String membername, int index)
CONSTANT_Methodref_info
,
CONSTANT_Fieldref_info
, or
CONSTANT_InterfaceMethodref_info
structure
affineTransform the given index represents the member with the specified
name and declaring class.
classname
- the class declaring the membermembername
- the member nameindex
- the index into the constant pool table
descriptor_index
specifying
the type descriptor of that member.
If it is not that member,
isMember()
returns 0.public int copy(int n, ConstPool dest, java.util.Map classnames)
n
- the n-th itemdest
- destination constant pool tableclassnames
- the map or null.public int addClassInfo(CompileTimeClass c)
CONSTANT_Class_info
structure.
This also adds a CONSTANT_Utf8_info
structure
for storing the class name.
public int addClassInfo(java.lang.String qname)
CONSTANT_Class_info
structure.
This also adds a CONSTANT_Utf8_info
structure
for storing the class name.
qname
- a fully-qualified class name
(or the JVM-internal representation of that name).
public int addNameAndTypeInfo(java.lang.String name, java.lang.String type)
CONSTANT_NameAndType_info
structure.
This also adds CONSTANT_Utf8_info
structures.
name
- name_index
type
- descriptor_index
public int addNameAndTypeInfo(int name, int type)
CONSTANT_NameAndType_info
structure.
name
- name_index
type
- descriptor_index
public int addFieldrefInfo(int classInfo, java.lang.String name, java.lang.String type)
CONSTANT_Fieldref_info
structure.
This also adds a new CONSTANT_NameAndType_info
structure.
classInfo
- class_index
name
- name_index
of CONSTANT_NameAndType_info
.type
- descriptor_index
of CONSTANT_NameAndType_info
.
public int addFieldrefInfo(int classInfo, int nameAndTypeInfo)
CONSTANT_Fieldref_info
structure.
classInfo
- class_index
nameandtypeinfo
- name_and_type_index
.
public int addMethodrefInfo(int classInfo, java.lang.String name, java.lang.String type)
CONSTANT_Methodref_info
structure.
This also adds a new CONSTANT_NameAndType_info
structure.
classInfo
- class_index
name
- name_index
of CONSTANT_NameAndType_info
.type
- descriptor_index
of CONSTANT_NameAndType_info
.
public int addMethodrefInfo(int classInfo, int nameAndTypeInfo)
CONSTANT_Methodref_info
structure.
classInfo
- class_index
nameandtypeinfo
- name_and_type_index
.
public int addInterfaceMethodrefInfo(int classInfo, java.lang.String name, java.lang.String type)
CONSTANT_InterfaceMethodref_info
structure.
This also adds a new CONSTANT_NameAndType_info
structure.
classInfo
- class_index
name
- name_index
of CONSTANT_NameAndType_info
.type
- descriptor_index
of CONSTANT_NameAndType_info
.
public int addInterfaceMethodrefInfo(int classInfo, int nameAndTypeInfo)
CONSTANT_InterfaceMethodref_info
structure.
classInfo
- class_index
nameandtypeinfo
- name_and_type_index
.
public int addStringInfo(java.lang.String str)
CONSTANT_String_info
structure.
This also adds a new CONSTANT_Utf8_info
structure.
public int addIntegerInfo(int i)
CONSTANT_Integer_info
structure.
public int addFloatInfo(float f)
CONSTANT_Float_info
structure.
public int addLongInfo(long l)
CONSTANT_Long_info
structure.
public int addDoubleInfo(double d)
CONSTANT_Double_info
structure.
public int addUtf8Info(java.lang.String utf8)
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.
public void renameClass(java.lang.String oldName, java.lang.String newName)
oldName
- the replaced namenewName
- the substituted name.public void renameClass(java.util.Map classnames)
classnames
- specifies pairs of replaced and substituted
name.public void write(java.io.DataOutputStream out) throws java.io.IOException
java.io.IOException
public void print()
public void print(java.io.PrintWriter out)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |