Package org.apache.bcel.classfile
Class FieldOrMethod
java.lang.Object
org.apache.bcel.classfile.AccessFlags
org.apache.bcel.classfile.FieldOrMethod
Abstract super class for fields and methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Attribute[]Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected intDeprecated.(since 6.0) will be removed (not needed)protected ConstantPoolDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected intDeprecated.(since 6.0) will be made private; do not access directly, use getter/setterFields inherited from class org.apache.bcel.classfile.AccessFlags
access_flags -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFieldOrMethod(int accessFlags, int nameIndex, int signatureIndex, Attribute[] attributes, ConstantPool constantPool) protectedFieldOrMethod(DataInput file, ConstantPool constantPool) Constructs object from file stream.protectedFieldOrMethod(DataInputStream file, ConstantPool constantPool) Deprecated.(6.0) UseFieldOrMethod(java.io.DataInput, ConstantPool)instead.protectedInitialize from another object. -
Method Summary
Modifier and TypeMethodDescriptionprotected FieldOrMethodcopy_(ConstantPool constantPool) final voiddump(DataOutputStream file) Dump object to file stream on binary format.final <T extends Attribute>
TgetAttribute(byte tag) Gets attribute for given tag.final Attribute[]final ConstantPoolfinal StringHunts for a signature attribute on the member and returns its contents.final StringgetName()final intfinal Stringfinal intfinal voidsetAttributes(Attribute[] attributes) final voidsetConstantPool(ConstantPool constantPool) final voidsetNameIndex(int nameIndex) final voidsetSignatureIndex(int signatureIndex) Methods inherited from class org.apache.bcel.classfile.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, setModifiers
-
Field Details
-
name_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
signature_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
attributes
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter -
attributes_count
Deprecated.(since 6.0) will be removed (not needed) -
constant_pool
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
-
Constructor Details
-
FieldOrMethod
Constructs object from file stream.- Parameters:
file- Input stream- Throws:
IOException- if an I/O error occurs.
-
FieldOrMethod
@Deprecated protected FieldOrMethod(DataInputStream file, ConstantPool constantPool) throws IOException Deprecated.(6.0) UseFieldOrMethod(java.io.DataInput, ConstantPool)instead.Constructs object from file stream.- Parameters:
file- Input stream- Throws:
IOException- if an I/O error occurs.
-
FieldOrMethod
Initialize from another object. Note that both objects use the same references (shallow copy). Use clone() for a physical copy.- Parameters:
c- Source to copy.
-
FieldOrMethod
protected FieldOrMethod(int accessFlags, int nameIndex, int signatureIndex, Attribute[] attributes, ConstantPool constantPool) - Parameters:
accessFlags- Access rights of methodnameIndex- Points to field name in constant poolsignatureIndex- Points to encoded signatureattributes- Collection of attributesconstantPool- Array of constants
-
-
Method Details
-
copy_
- Returns:
- deep copy of this field
-
dump
Dump object to file stream on binary format.- Parameters:
file- Output file stream- Throws:
IOException- if an I/O error occurs.
-
getAnnotationEntries
- Returns:
- Annotations on the field or method
- Since:
- 6.0
-
getAttribute
Gets attribute for given tag.- Returns:
- Attribute for given tag, null if not found.
Refer to
Const.ATTR_UNKNOWNconstants named ATTR_* for possible values. - Since:
- 6.10.0
-
getAttributes
- Returns:
- Collection of object attributes.
-
getConstantPool
- Returns:
- Constant pool used by this object.
-
getGenericSignature
Hunts for a signature attribute on the member and returns its contents. So where the 'regular' signature may be (Ljava/util/Vector;)V the signature attribute may in fact say 'Ljava/lang/Vector<Ljava/lang/String>;' Coded for performance - searches for the attribute only when requested - only searches for it once.- Since:
- 6.0
-
getName
- Returns:
- Name of object, i.e., method name or field name
-
getNameIndex
- Returns:
- Index in constant pool of object's name.
-
getSignature
- Returns:
- String representation of object's type signature (Java style)
-
getSignatureIndex
- Returns:
- Index in constant pool of field signature.
-
setAttributes
- Parameters:
attributes- Collection of object attributes.
-
setConstantPool
- Parameters:
constantPool- Constant pool to be used for this object.
-
setNameIndex
- Parameters:
nameIndex- Index in constant pool of object's name.
-
setSignatureIndex
- Parameters:
signatureIndex- Index in constant pool of field signature.
-