Package org.apache.bcel.classfile
Class FieldOrMethod
- java.lang.Object
-
- org.apache.bcel.classfile.AccessFlags
-
- org.apache.bcel.classfile.FieldOrMethod
-
- All Implemented Interfaces:
java.lang.Cloneable
,Node
public abstract class FieldOrMethod extends AccessFlags implements java.lang.Cloneable, Node
Abstract super class for fields and methods.
-
-
Field Summary
Fields Modifier and Type Field Description private AnnotationEntry[]
annotationEntries
protected Attribute[]
attributes
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected int
attributes_count
Deprecated.(since 6.0) will be removed (not needed)protected ConstantPool
constant_pool
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprotected int
name_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprivate boolean
searchedForSignatureAttribute
protected int
signature_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setterprivate java.lang.String
signatureAttributeString
-
Fields inherited from class org.apache.bcel.classfile.AccessFlags
access_flags
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)
FieldOrMethod()
protected
FieldOrMethod(int accessFlags, int nameIndex, int signatureIndex, Attribute[] attributes, ConstantPool constantPool)
protected
FieldOrMethod(java.io.DataInput file, ConstantPool constantPool)
Constructs object from file stream.protected
FieldOrMethod(java.io.DataInputStream file, ConstantPool constantPool)
Deprecated.(6.0) UseFieldOrMethod(java.io.DataInput, ConstantPool)
instead.protected
FieldOrMethod(FieldOrMethod c)
Initialize from another object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FieldOrMethod
copy_(ConstantPool constantPool)
void
dump(java.io.DataOutputStream file)
Dump object to file stream on binary format.AnnotationEntry[]
getAnnotationEntries()
Attribute[]
getAttributes()
ConstantPool
getConstantPool()
java.lang.String
getGenericSignature()
Hunts for a signature attribute on the member and returns its contents.java.lang.String
getName()
int
getNameIndex()
java.lang.String
getSignature()
int
getSignatureIndex()
void
setAttributes(Attribute[] attributes)
void
setConstantPool(ConstantPool constantPool)
void
setNameIndex(int nameIndex)
void
setSignatureIndex(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 Detail
-
name_index
@Deprecated protected int name_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
signature_index
@Deprecated protected int signature_index
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
attributes
@Deprecated protected Attribute[] attributes
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
attributes_count
@Deprecated protected int attributes_count
Deprecated.(since 6.0) will be removed (not needed)
-
annotationEntries
private AnnotationEntry[] annotationEntries
-
constant_pool
@Deprecated protected ConstantPool constant_pool
Deprecated.(since 6.0) will be made private; do not access directly, use getter/setter
-
signatureAttributeString
private java.lang.String signatureAttributeString
-
searchedForSignatureAttribute
private boolean searchedForSignatureAttribute
-
-
Constructor Detail
-
FieldOrMethod
FieldOrMethod()
-
FieldOrMethod
protected FieldOrMethod(java.io.DataInput file, ConstantPool constantPool) throws java.io.IOException
Constructs object from file stream.- Parameters:
file
- Input stream- Throws:
java.io.IOException
- if an I/O error occurs.
-
FieldOrMethod
@Deprecated protected FieldOrMethod(java.io.DataInputStream file, ConstantPool constantPool) throws java.io.IOException
Deprecated.(6.0) UseFieldOrMethod(java.io.DataInput, ConstantPool)
instead.Constructs object from file stream.- Parameters:
file
- Input stream- Throws:
java.io.IOException
- if an I/O error occurs.
-
FieldOrMethod
protected FieldOrMethod(FieldOrMethod c)
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 Detail
-
copy_
protected FieldOrMethod copy_(ConstantPool constantPool)
- Returns:
- deep copy of this field
-
dump
public final void dump(java.io.DataOutputStream file) throws java.io.IOException
Dump object to file stream on binary format.- Parameters:
file
- Output file stream- Throws:
java.io.IOException
- if an I/O error occurs.
-
getAnnotationEntries
public AnnotationEntry[] getAnnotationEntries()
- Returns:
- Annotations on the field or method
- Since:
- 6.0
-
getAttributes
public final Attribute[] getAttributes()
- Returns:
- Collection of object attributes.
-
getConstantPool
public final ConstantPool getConstantPool()
- Returns:
- Constant pool used by this object.
-
getGenericSignature
public final java.lang.String 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
public final java.lang.String getName()
- Returns:
- Name of object, i.e., method name or field name
-
getNameIndex
public final int getNameIndex()
- Returns:
- Index in constant pool of object's name.
-
getSignature
public final java.lang.String getSignature()
- Returns:
- String representation of object's type signature (Java style)
-
getSignatureIndex
public final int getSignatureIndex()
- Returns:
- Index in constant pool of field signature.
-
setAttributes
public final void setAttributes(Attribute[] attributes)
- Parameters:
attributes
- Collection of object attributes.
-
setConstantPool
public final void setConstantPool(ConstantPool constantPool)
- Parameters:
constantPool
- Constant pool to be used for this object.
-
setNameIndex
public final void setNameIndex(int nameIndex)
- Parameters:
nameIndex
- Index in constant pool of object's name.
-
setSignatureIndex
public final void setSignatureIndex(int signatureIndex)
- Parameters:
signatureIndex
- Index in constant pool of field signature.
-
-