APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.org.apache.bcel.internal.generic

public abstract Class FieldOrMethod

extends CPInstruction
implements LoadClass
Class Inheritance
All Implemented Interfaces
com.sun.org.apache.bcel.internal.generic.LoadClass
Known Direct Subclasses
com.sun.org.apache.bcel.internal.generic.InvokeInstruction, com.sun.org.apache.bcel.internal.generic.FieldInstruction
Imports
com.sun.org.apache.bcel.internal.Const, com.sun.org.apache.bcel.internal.classfile.ConstantCP, .ConstantNameAndType, .ConstantPool, .ConstantUtf8, .Utility

Super class for InvokeInstruction and FieldInstruction, since they have some methods in common!

Field Summary

Inherited from com.sun.org.apache.bcel.internal.generic.CPInstruction:
index

Constructor Summary

AccessConstructor and Description
pack-priv
FieldOrMethod()

Empty constructor needed for Instruction.readInstruction.

protected
FieldOrMethod(final short opcode, final int
to constant pool
index
)

Method Summary

Modifier and TypeMethod and Description
public String
getClassName(final ConstantPoolGen cpg)
Deprecated If the instruction references an array class, this method will return "java.lang.Object".

Returns: name of the referenced class/interface

public ObjectType
getClassType(final ConstantPoolGen cpg)
Deprecated If the instruction references an array class, the ObjectType returned will be invalid. Use getReferenceType() instead.

Returns: type of the referenced class/interface

public ObjectType

Returns:

type of the referenced class/interface
getLoadClassType
(final ConstantPoolGen cpg)

Implements com.sun.org.apache.bcel.internal.generic.LoadClass.getLoadClassType.

Gets the ObjectType of the method return or field.

public String
getName(final ConstantPoolGen cpg)

Returns: name of referenced method/field.

public ReferenceType

Returns:

an ObjectType (if the referenced class type is a class or interface), or an ArrayType (if the referenced class type is an array class)
getReferenceType
(final ConstantPoolGen
the ConstantPoolGen used to create the instruction
cpg
)

Gets the reference type representing the class, interface, or array class referenced by the instruction.

public String
getSignature(final ConstantPoolGen cpg)

Returns: signature of referenced method/field.

Inherited from com.sun.org.apache.bcel.internal.generic.CPInstruction:
dumpgetIndexgetTypeinitFromFilesetIndextoStringtoString

Constructor Detail

FieldOrMethodback to summary
pack-priv FieldOrMethod()

Empty constructor needed for Instruction.readInstruction. Not to be used otherwise.

FieldOrMethodback to summary
protected FieldOrMethod(final short opcode, final int index)
Parameters
index:int

to constant pool

Method Detail

getClassNameback to summary
public String getClassName(final ConstantPoolGen cpg)

Deprecated

If the instruction references an array class, this method will return "java.lang.Object". For code generated by Java 1.5, this answer is sometimes wrong (e.g., if the "clone()" method is called on an array). A better idea is to use the getReferenceType(ConstantPoolGen) method, which correctly distinguishes between class types and array types.

Returns:String

name of the referenced class/interface

Annotations
@Deprecated
getClassTypeback to summary
public ObjectType getClassType(final ConstantPoolGen cpg)

Deprecated

If the instruction references an array class, the ObjectType returned will be invalid. Use getReferenceType() instead.

Returns:ObjectType

type of the referenced class/interface

Annotations
@Deprecated
getLoadClassTypeback to summary
public ObjectType getLoadClassType(final ConstantPoolGen cpg)

Implements com.sun.org.apache.bcel.internal.generic.LoadClass.getLoadClassType.

Gets the ObjectType of the method return or field.

Returns:ObjectType

type of the referenced class/interface

Annotations
@Override
Exceptions
ClassGenException:
when the field is (or method returns) an array,
getNameback to summary
public String getName(final ConstantPoolGen cpg)
Returns:String

name of referenced method/field.

getReferenceTypeback to summary
public ReferenceType getReferenceType(final ConstantPoolGen cpg)

Gets the reference type representing the class, interface, or array class referenced by the instruction.

Parameters
cpg:ConstantPoolGen

the ConstantPoolGen used to create the instruction

Returns:ReferenceType

an ObjectType (if the referenced class type is a class or interface), or an ArrayType (if the referenced class type is an array class)

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

signature of referenced method/field.