Class Field
java.lang.Object
org.apache.bcel.classfile.AccessFlags
org.apache.bcel.classfile.FieldOrMethod
org.apache.bcel.classfile.Field
This class represents the field info structure, that is, the representation for a variable in the class. See JVM
specification for details.
-
Field Summary
FieldsFields inherited from class FieldOrMethod
attributes, attributes_count, constant_pool, name_index, signature_indexModifier and TypeFieldDescriptionprotected Attribute[]Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter.protected intDeprecated.(since 6.0) will be removed (not needed)protected ConstantPoolDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter.protected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter.protected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter.Fields inherited from class AccessFlags
access_flagsModifier and TypeFieldDescriptionprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setter. -
Constructor Summary
ConstructorsConstructorDescriptionField(int accessFlags, int nameIndex, int signatureIndex, Attribute[] attributes, ConstantPool constantPool) Constructs a Field.Initialize from another object. -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled by objects that are traversing the nodes of the tree implicitly defined by the contents of a Java class.copy(ConstantPool constantPool) Creates a deep copy of this field.booleanReturn value as defined by given BCELComparator strategy.static BCELComparator<Field> Gets the comparison strategy object.Gets the constant value associated with this field.getType()Gets the field type.inthashCode()Return value as defined by given BCELComparator strategy.static voidsetComparator(BCELComparator<Field> comparator) Sets the comparison strategy object.toString()Return string representation close to declaration format, for example: 'public static final short MAX = 100'.Methods inherited from class FieldOrMethod
copy_, dump, getAnnotationEntries, getAttribute, getAttributes, getConstantPool, getGenericSignature, getName, getNameIndex, getSignature, getSignatureIndex, setAttributes, setConstantPool, setNameIndex, setSignatureIndexModifier and TypeMethodDescriptionprotected FieldOrMethodcopy_(ConstantPool constantPool) Creates a deep copy of this field.final voiddump(DataOutputStream file) Dumps object to file stream on binary format.Gets annotations on the field or method.final <T extends Attribute>
TgetAttribute(byte tag) Gets attribute for given tag.final Attribute[]Gets the collection of object attributes.final ConstantPoolGets the constant pool used by this object.final StringGets the contents of the signature attribute on this member.final StringgetName()Gets the name of object.final intGets the index in constant pool of object's name.final StringGets the string representation of object's type signature.final intGets the index in constant pool of field signature.final voidsetAttributes(Attribute[] attributes) Sets the collection of object attributes.final voidsetConstantPool(ConstantPool constantPool) Sets the constant pool to be used for this object.final voidsetNameIndex(int nameIndex) Sets the index in constant pool of object's name.final voidsetSignatureIndex(int signatureIndex) Sets the index in constant pool of field signature.Methods inherited from class AccessFlags
getAccessFlags, getModifiers, isAbstract, isAbstract, isAnnotation, isAnnotation, isEnum, isEnum, isFinal, isFinal, isInterface, isInterface, isNative, isNative, isPrivate, isPrivate, isProtected, isProtected, isPublic, isPublic, isStatic, isStatic, isStrictfp, isStrictfp, isSynchronized, isSynchronized, isSynthetic, isSynthetic, isTransient, isTransient, isVarArgs, isVarArgs, isVolatile, isVolatile, setAccessFlags, setModifiersModifier and TypeMethodDescriptionfinal intGets access flags.final intGets access flags.final booleanTests whether the abstract bit is on.final voidisAbstract(boolean flag) Sets the abstract bit.final booleanTests whether the annotation bit is on.final voidisAnnotation(boolean flag) Sets the annotation bit.final booleanisEnum()Tests whether the enum bit is on.final voidisEnum(boolean flag) Sets the enum bit.final booleanisFinal()Tests whether the final bit is on.final voidisFinal(boolean flag) Sets the final bit.final booleanTests whether the interface bit is on.final voidisInterface(boolean flag) Sets the interface bit.final booleanisNative()Tests whether the native bit is on.final voidisNative(boolean flag) Sets the native bit.final booleanTests whether the private bit is on.final voidisPrivate(boolean flag) Sets the private bit.final booleanTests whether the protected bit is on.final voidisProtected(boolean flag) Sets the protected bit.final booleanisPublic()Tests whether the public bit is on.final voidisPublic(boolean flag) Sets the public bit.final booleanisStatic()Tests whether the static bit is on.final voidisStatic(boolean flag) Sets the static bit.final booleanTests whether the strict bit is on.final voidisStrictfp(boolean flag) Sets the strict bit.final booleanTests whether the synchronized bit is on.final voidisSynchronized(boolean flag) Sets the synchronized bit.final booleanTests whether the synthetic bit is on.final voidisSynthetic(boolean flag) Sets the synthetic bit.final booleanTests whether the transient bit is on.final voidisTransient(boolean flag) Sets the transient bit.final booleanTests whether the varargs bit is on.final voidisVarArgs(boolean flag) Sets the varargs bit.final booleanTests whether the volatile bit is on.final voidisVolatile(boolean flag) Sets the volatile bit.final voidsetAccessFlags(int accessFlags) Sets access flags also known as modifiers.final voidsetModifiers(int accessFlags) Sets access flags aka "modifiers".
-
Field Details
-
EMPTY_ARRAY
-
-
Constructor Details
-
Field
-
Field
public Field(int accessFlags, int nameIndex, int signatureIndex, Attribute[] attributes, ConstantPool constantPool) Constructs a Field.- Parameters:
accessFlags- Access rights of field.nameIndex- Points to field name in constant pool.signatureIndex- Points to encoded signature.attributes- Collection of attributes.constantPool- Array of constants.
-
-
Method Details
-
getComparator
Gets the comparison strategy object.- Returns:
- Comparison strategy object.
-
setComparator
Sets the comparison strategy object.- Parameters:
comparator- Comparison strategy object.
-
accept
-
copy
Creates a deep copy of this field.- Parameters:
constantPool- The constant pool.- Returns:
- deep copy of this field.
-
equals
-
getConstantValue
Gets the constant value associated with this field.- Returns:
- constant value associated with this field (may be null).
-
getType
-
hashCode
-
toString
-