Class FieldInfo
java.lang.Object
org.fife.rsta.ac.java.classreader.MemberInfo
org.fife.rsta.ac.java.classreader.FieldInfo
Represents a "field_info" structure as defined by the Java VM spec.
- Version:
- 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<AttributeInfo> An array of attributes of this field.static final Stringprivate intIndex into the constant pool of aConstantUtf8Infostructure representing a valid field descriptor.private intIndex into the constant pool of aConstantUtf8Infostructure representing the field name, as a simple name.Fields inherited from class MemberInfo
cf, DEPRECATED, RUNTIME_VISIBLE_ANNOTATIONS, SIGNATURE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(AttributeInfo info) Adds the specified attribute to this field.getAttribute(int index) Returns the specified attribute.intReturns the number of attributes of this field.Returns this constant value as a string.private ConstantValueReturns theConstantValueattribute info for this field, if any.Returns the field descriptor of this field.getName()Returns the name of this member.intReturns the index into the constant pool of aConstantUtf8Infostructure representing the field name, as a simple name.getTypeString(boolean qualified) Returns the type of this field, as determined from its field descriptor.booleanReturns whether this field is a constant.static FieldInforead(ClassFile cf, DataInputStream in) Reads aFieldInfostructure from the specified input stream.private AttributeInfoReads an attribute for this field from an input stream.Methods inherited from class MemberInfo
getAccessFlags, getClassFile, isDeprecated, isFinal, isStatic, readAttribute
-
Field Details
-
nameIndex
private int nameIndexIndex into the constant pool of aConstantUtf8Infostructure representing the field name, as a simple name. -
descriptorIndex
private int descriptorIndexIndex into the constant pool of aConstantUtf8Infostructure representing a valid field descriptor. -
attributes
An array of attributes of this field. -
CONSTANT_VALUE
- See Also:
-
-
Constructor Details
-
FieldInfo
Constructor.- Parameters:
cf- The class file being parsed.accessFlags- The access flags.nameIndex- The name index.descriptorIndex- The descriptor index.- See Also:
-
-
Method Details
-
addAttribute
Adds the specified attribute to this field.- Parameters:
info- Information about the attribute.
-
getAttribute
Returns the specified attribute.- Parameters:
index- The index of the attribute.- Returns:
- The attribute.
-
getAttributeCount
public int getAttributeCount()Returns the number of attributes of this field.- Returns:
- The number of attributes.
-
getConstantValueAsString
Returns this constant value as a string.- Returns:
- A string representation of this constant value, or
nullif it isn't one.
-
getConstantValueAttributeInfo
Returns theConstantValueattribute info for this field, if any.- Returns:
- The
ConstantValueattribute, ornullif there isn't one.
-
getDescriptor
Returns the field descriptor of this field.- Specified by:
getDescriptorin classMemberInfo- Returns:
- The field descriptor of this field.
-
getName
Description copied from class:MemberInfoReturns the name of this member.- Specified by:
getNamein classMemberInfo- Returns:
- The name of this member.
-
getNameIndex
public int getNameIndex()Returns the index into the constant pool of aConstantUtf8Infostructure representing the field name, as a simple name.- Returns:
- The index into the constant pool.
-
getTypeString
Returns the type of this field, as determined from its field descriptor.- Parameters:
qualified- Whether the returned value should be fully-qualified.- Returns:
- The type of this field.
-
isConstant
public boolean isConstant()Returns whether this field is a constant.- Returns:
- Whether this field is a constant.
-
read
Reads aFieldInfostructure from the specified input stream.- Parameters:
cf- The class file containing this field.in- The input stream to read from.- Returns:
- The field information read.
- Throws:
IOException- If an IO error occurs.
-
readAttribute
Reads an attribute for this field from an input stream.- Parameters:
in- The input stream to read from.- Returns:
- The attribute read, possibly
nullif it was known to be unimportant for our purposes. - Throws:
IOException- If an IO error occurs.
-