Constant Pool classesThe Constant Pool classes allows you to manipulate the entries of a classfile's constant pool. A constant pool contains entries for:
The ValueRef class is for all the non-immediate int, long, float, double, and String constants used in the class. The FieldRef class is for the fields referenced in the class. The MethodRef class is for the methods referenced in the class. The TypeRef class is for the classes and arrays referenced in the class. These classes do not have public constructors. To reach a classfile's pool entries, you must use firstValueRef, firstFieldRef, firstMethodRef, or firstTypeRef in the ClassFile class. You can also get the pool entry referenced by an instruction via getReferenceArg. Method Summary
Fieldspublic Object userDefined Field that can be used by an application developer to store arbitrary data about this object during the trek. MethodsIn ValueRef: public Object
getObject() Returns the String, Integer, Long, Float, or Double object referenced by this ValueRef. Returns the code object referenced by this field, method, or class reference if its classfile can be accessed via getClassFile. Otherwise an exception is thrown. An array reference does not reference an object; so getObject for an array TypeRef always returns null. In FieldRef: public
TypeRef getTypeRef() Returns the TypeRef of the referenced member's class. In ValueRef: public Constant
next() Returns the next entry with the same type as this entry. If there are no more entries of this type, null is returned instead. In MethodRef: public void redirect(String clname, String name, String desc)
In FieldRef: public String
toName() Returns the name of the referenced field, method, or class. Returns null if this entry is an array reference. In TypeRef: public String toQualifiedName() Returns the qualified name of the referenced class. Returns null if this entry is an array reference. In all: public String toString() Returns the information in this entry in a source-like form. For a String constant, bounding double quotes are included in what is returned. For a field or method reference, the signature of the referenced member is returned. For a type reference, the returned string looks like the right term of an instanceof.
|