org.apache.bcel.classfile

Class FieldOrMethod

public abstract class FieldOrMethod extends AccessFlags implements Cloneable, Node

Abstract super class for fields and methods.
Field Summary
protected Attribute[]attributes
protected intattributes_count
protected ConstantPoolconstant_pool
protected intname_index
protected intsignature_index
Constructor Summary
protected FieldOrMethod(FieldOrMethod c)
Initialize from another object.
protected FieldOrMethod(DataInputStream file, ConstantPool constant_pool)
Construct object from file stream.
protected FieldOrMethod(int access_flags, int name_index, int signature_index, Attribute[] attributes, ConstantPool constant_pool)
Method Summary
protected FieldOrMethodcopy_(ConstantPool _constant_pool)
voiddump(DataOutputStream file)
Dump object to file stream on binary format.
Attribute[]getAttributes()
ConstantPoolgetConstantPool()
StringgetName()
intgetNameIndex()
StringgetSignature()
intgetSignatureIndex()
voidsetAttributes(Attribute[] attributes)
voidsetConstantPool(ConstantPool constant_pool)
voidsetNameIndex(int name_index)
voidsetSignatureIndex(int signature_index)

Field Detail

attributes

protected Attribute[] attributes

attributes_count

protected int attributes_count

constant_pool

protected ConstantPool constant_pool

name_index

protected int name_index

signature_index

protected int signature_index

Constructor Detail

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.

FieldOrMethod

protected FieldOrMethod(DataInputStream file, ConstantPool constant_pool)
Construct object from file stream.

Parameters: file Input stream

Throws: IOException ClassFormatException

FieldOrMethod

protected FieldOrMethod(int access_flags, int name_index, int signature_index, Attribute[] attributes, ConstantPool constant_pool)

Parameters: access_flags Access rights of method name_index Points to field name in constant pool signature_index Points to encoded signature attributes Collection of attributes constant_pool Array of constants

Method Detail

copy_

protected FieldOrMethod copy_(ConstantPool _constant_pool)

Returns: deep copy of this field

dump

public final void dump(DataOutputStream file)
Dump object to file stream on binary format.

Parameters: file Output file stream

Throws: IOException

getAttributes

public final Attribute[] getAttributes()

Returns: Collection of object attributes.

getConstantPool

public final ConstantPool getConstantPool()

Returns: Constant pool used by this object.

getName

public final 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 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 constant_pool)

Parameters: constant_pool Constant pool to be used for this object.

setNameIndex

public final void setNameIndex(int name_index)

Parameters: name_index Index in constant pool of object's name.

setSignatureIndex

public final void setSignatureIndex(int signature_index)

Parameters: signature_index Index in constant pool of field signature.