Top Description Fields Constructors Methods
org.apache.bcel.classfile

public abstract Class FieldOrMethod

extends AccessFlags
implements Cloneable, Node
Class Inheritance
All Implemented Interfaces
org.apache.bcel.classfile.Node, java.lang.Cloneable
Known Direct Subclasses
org.apache.bcel.classfile.Method, org.apache.bcel.classfile.Field
Imports
java.io.DataInput, .DataInputStream, .DataOutputStream, .IOException, java.util.Arrays

Abstract super class for fields and methods.

Field Summary

Modifier and TypeField and Description
private AnnotationEntry[]
protected Attribute[]
attributes

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
protected 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/setter
protected int
name_index

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
private boolean
protected int
signature_index

Deprecated (since 6.0) will be made private; do not access directly, use getter/setter
private String
Inherited from org.apache.bcel.classfile.AccessFlags:
access_flags

Constructor Summary

AccessConstructor and Description
pack-priv
protected
FieldOrMethod(final DataInput
Input stream
file
,
final ConstantPool constantPool)

Constructs object from file stream.

protected
FieldOrMethod(final DataInputStream
Input stream
file
,
final ConstantPool constantPool)

Deprecated (6.0) Use FieldOrMethod(java.io.DataInput, ConstantPool) instead.
Constructs object from file stream.
protected
FieldOrMethod(final FieldOrMethod
Source to copy.
c
)

Initialize from another object.

protected
FieldOrMethod(final int
Access rights of method
accessFlags
,
final int
Points to field name in constant pool
nameIndex
,
final int
Points to encoded signature
signatureIndex
,
final Attribute[]
Collection of attributes
attributes
,
final ConstantPool
Array of constants
constantPool
)

Method Summary

Modifier and TypeMethod and Description
protected FieldOrMethod

Returns:

deep copy of this field
copy_
(final ConstantPool constantPool)

public final void
dump(final DataOutputStream
Output file stream
file
)

Dump object to file stream on binary format.

public AnnotationEntry[]

Returns:

Annotations on the field or method
getAnnotationEntries
()

public final Attribute[]

Returns:

Collection of object attributes.
getAttributes
()

public final ConstantPool

Returns:

Constant pool used by this object.
getConstantPool
()

public final String
getGenericSignature()

Hunts for a signature attribute on the member and returns its contents.

public final String

Returns:

Name of object, i.e., method name or field name
getName
()

public final int

Returns:

Index in constant pool of object's name.
getNameIndex
()

public final String

Returns:

String representation of object's type signature (Java style)
getSignature
()

public final int

Returns:

Index in constant pool of field signature.
getSignatureIndex
()

public final void
setAttributes(final Attribute[]
Collection of object attributes.
attributes
)

public final void
setConstantPool(final ConstantPool
Constant pool to be used for this object.
constantPool
)

public final void
setNameIndex(final int
Index in constant pool of object's name.
nameIndex
)

public final void
setSignatureIndex(final int
Index in constant pool of field signature.
signatureIndex
)

Inherited from org.apache.bcel.classfile.AccessFlags:
getAccessFlagsgetModifiersisAbstractisAbstractisAnnotationisAnnotationisEnumisEnumisFinalisFinalisInterfaceisInterfaceisNativeisNativeisPrivateisPrivateisProtectedisProtectedisPublicisPublicisStaticisStaticisStrictfpisStrictfpisSynchronizedisSynchronizedisSyntheticisSyntheticisTransientisTransientisVarArgsisVarArgsisVolatileisVolatilesetAccessFlagssetModifiers

Field Detail

annotationEntriesback to summary
private AnnotationEntry[] annotationEntries
attributesback to summary
protected Attribute[] attributes

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
attributes_countback to summary
protected int attributes_count

Deprecated

(since 6.0) will be removed (not needed)

Annotations
@Deprecated
constant_poolback to summary
protected ConstantPool constant_pool

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
name_indexback to summary
protected int name_index

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
searchedForSignatureAttributeback to summary
private boolean searchedForSignatureAttribute
signature_indexback to summary
protected int signature_index

Deprecated

(since 6.0) will be made private; do not access directly, use getter/setter

Annotations
@Deprecated
signatureAttributeStringback to summary
private String signatureAttributeString

Constructor Detail

FieldOrMethodback to summary
pack-priv FieldOrMethod()
FieldOrMethodback to summary
protected FieldOrMethod(final DataInput file, final ConstantPool constantPool) throws IOException

Constructs object from file stream.

Parameters
file:DataInput

Input stream

Exceptions
IOException:
if an I/O error occurs.
FieldOrMethodback to summary
protected FieldOrMethod(final DataInputStream file, final ConstantPool constantPool) throws IOException

Deprecated

(6.0) Use FieldOrMethod(java.io.DataInput, ConstantPool) instead.

Constructs object from file stream.

Parameters
file:DataInputStream

Input stream

Annotations
@Deprecated
Exceptions
IOException:
if an I/O error occurs.
FieldOrMethodback to summary
protected FieldOrMethod(final FieldOrMethod c)

Initialize from another object. Note that both objects use the same references (shallow copy). Use clone() for a physical copy.

Parameters
c:FieldOrMethod

Source to copy.

FieldOrMethodback to summary
protected FieldOrMethod(final int accessFlags, final int nameIndex, final int signatureIndex, final Attribute[] attributes, final ConstantPool constantPool)
Parameters
accessFlags:int

Access rights of method

nameIndex:int

Points to field name in constant pool

signatureIndex:int

Points to encoded signature

attributes:Attribute[]

Collection of attributes

constantPool:ConstantPool

Array of constants

Method Detail

copy_back to summary
protected FieldOrMethod copy_(final ConstantPool constantPool)
Returns:FieldOrMethod

deep copy of this field

dumpback to summary
public final void dump(final DataOutputStream file) throws IOException

Dump object to file stream on binary format.

Parameters
file:DataOutputStream

Output file stream

Exceptions
IOException:
if an I/O error occurs.
getAnnotationEntriesback to summary
public AnnotationEntry[] getAnnotationEntries()
Returns:AnnotationEntry[]

Annotations on the field or method

Since
6.0
getAttributesback to summary
public final Attribute[] getAttributes()
Returns:Attribute[]

Collection of object attributes.

getConstantPoolback to summary
public final ConstantPool getConstantPool()
Returns:ConstantPool

Constant pool used by this object.

getGenericSignatureback to summary
public final 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
getNameback to summary
public final String getName()
Returns:String

Name of object, i.e., method name or field name

getNameIndexback to summary
public final int getNameIndex()
Returns:int

Index in constant pool of object's name.

getSignatureback to summary
public final String getSignature()
Returns:String

String representation of object's type signature (Java style)

getSignatureIndexback to summary
public final int getSignatureIndex()
Returns:int

Index in constant pool of field signature.

setAttributesback to summary
public final void setAttributes(final Attribute[] attributes)
Parameters
attributes:Attribute[]

Collection of object attributes.

setConstantPoolback to summary
public final void setConstantPool(final ConstantPool constantPool)
Parameters
constantPool:ConstantPool

Constant pool to be used for this object.

setNameIndexback to summary
public final void setNameIndex(final int nameIndex)
Parameters
nameIndex:int

Index in constant pool of object's name.

setSignatureIndexback to summary
public final void setSignatureIndex(final int signatureIndex)
Parameters
signatureIndex:int

Index in constant pool of field signature.