public class FieldInfo extends MemberInfo
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONSTANT_VALUE |
cf, DEPRECATED, RUNTIME_VISIBLE_ANNOTATIONS, SIGNATURE| Constructor and Description |
|---|
FieldInfo(ClassFile cf,
int accessFlags,
int nameIndex,
int descriptorIndex)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(AttributeInfo info)
Adds the specified attribute to this field.
|
AttributeInfo |
getAttribute(int index)
Returns the specified attribute.
|
int |
getAttributeCount()
Returns the number of attributes of this field.
|
java.lang.String |
getConstantValueAsString()
Returns this constant value as a string.
|
java.lang.String |
getDescriptor()
Returns the field descriptor of this field.
|
java.lang.String |
getName()
Returns the name of this member.
|
int |
getNameIndex()
Returns the index into the constant pool of a
ConstantUtf8Info
structure representing the field name, as a simple name. |
java.lang.String |
getTypeString(boolean qualified)
Returns the type of this field, as determined from its field descriptor.
|
boolean |
isConstant()
Returns whether this field is a constant.
|
static FieldInfo |
read(ClassFile cf,
java.io.DataInputStream in)
Reads a
FieldInfo structure from the specified input
stream. |
getAccessFlags, getClassFile, isDeprecated, isFinal, isStatic, readAttributepublic static final java.lang.String CONSTANT_VALUE
public FieldInfo(ClassFile cf, int accessFlags, int nameIndex, int descriptorIndex)
cf - The class file being parsed.accessFlags - The access flags.nameIndex - The name index.descriptorIndex - The descriptor index.AccessFlagspublic void addAttribute(AttributeInfo info)
info - Information about the attribute.public AttributeInfo getAttribute(int index)
index - The index of the attribute.public int getAttributeCount()
public java.lang.String getConstantValueAsString()
null if it isn't one.public java.lang.String getDescriptor()
getDescriptor in class MemberInfopublic java.lang.String getName()
MemberInfogetName in class MemberInfopublic int getNameIndex()
ConstantUtf8Info
structure representing the field name, as a simple name.public java.lang.String getTypeString(boolean qualified)
qualified - Whether the returned value should be fully-qualified.public boolean isConstant()
public static FieldInfo read(ClassFile cf, java.io.DataInputStream in) throws java.io.IOException
FieldInfo structure from the specified input
stream.cf - The class file containing this field.in - The input stream to read from.java.io.IOException - If an IO error occurs.