org.apache.bcel.generic

Class FieldInstruction

Implemented Interfaces:
Cloneable, IndexedInstruction, LoadClass, Serializable, TypedInstruction
Known Direct Subclasses:
GETFIELD, GETSTATIC, PUTFIELD, PUTSTATIC

public abstract class FieldInstruction
extends FieldOrMethod
implements TypedInstruction

Super class for the GET/PUTxxx family of instructions.
Version:
$Id: FieldInstruction.java 386056 2006-03-15 11:31:56Z tcurdt $
Author:
M. Dahm

Field Summary

Fields inherited from class org.apache.bcel.generic.CPInstruction

index

Fields inherited from class org.apache.bcel.generic.Instruction

cmp, length, opcode

Constructor Summary

FieldInstruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction().
FieldInstruction(short opcode, int index)

Method Summary

String
getFieldName(ConstantPoolGen cpg)
protected int
getFieldSize(ConstantPoolGen cpg)
Type
getFieldType(ConstantPoolGen cpg)
Type
getType(ConstantPoolGen cpg)
String
toString(ConstantPool cp)

Methods inherited from class org.apache.bcel.generic.FieldOrMethod

getClassName, getClassType, getLoadClassType, getName, getReferenceType, getSignature

Methods inherited from class org.apache.bcel.generic.CPInstruction

dump, getIndex, getType, initFromFile, setIndex, toString, toString

Methods inherited from class org.apache.bcel.generic.Instruction

accept, className, consumeStack, copy, dispose, dump, equals, getComparator, getLength, getName, getOpcode, initFromFile, produceStack, readInstruction, setComparator, setOpcode, toString, toString, toString

Constructor Details

FieldInstruction

(package private)  FieldInstruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

FieldInstruction

protected FieldInstruction(short opcode,
                           int index)
Parameters:
index - to constant pool

Method Details

getFieldName

public String getFieldName(ConstantPoolGen cpg)
Returns:
name of referenced field.

getFieldSize

protected int getFieldSize(ConstantPoolGen cpg)
Returns:
size of field (1 or 2)

getFieldType

public Type getFieldType(ConstantPoolGen cpg)
Returns:
type of field

getType

public Type getType(ConstantPoolGen cpg)
Specified by:
getType in interface TypedInstruction
getType in interface LoadClass
Overrides:
getType in interface CPInstruction
Returns:
return type of referenced field

toString

public String toString(ConstantPool cp)
Overrides:
toString in interface CPInstruction
Returns:
mnemonic for instruction with symbolic references resolved