FileDocCategorySizeDatePackage
FieldOrMethod.javaAPI DocJava SE 5 API4884Fri Aug 26 14:55:20 BST 2005com.sun.org.apache.bcel.internal.generic

FieldOrMethod

public abstract class FieldOrMethod extends CPInstruction implements LoadClass
Super class for InvokeInstruction and FieldInstruction, since they have some methods in common!
version
$Id: FieldOrMethod.java,v 1.1.1.1 2001/10/29 20:00:13 jvanzyl Exp $
author
M. Dahm

Fields Summary
Constructors Summary
FieldOrMethod()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

protected FieldOrMethod(short opcode, int index)

param
index to constant pool

    super(opcode, index);
  
Methods Summary
public java.lang.StringgetClassName(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

return
name of the referenced class/interface

    ConstantPool cp  = cpg.getConstantPool();
    ConstantCP   cmr = (ConstantCP)cp.getConstant(index);
    return cp.getConstantString(cmr.getClassIndex(), com.sun.org.apache.bcel.internal.Constants.CONSTANT_Class).replace('/", '.");
  
public com.sun.org.apache.bcel.internal.generic.ObjectTypegetClassType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

return
type of the referenced class/interface

    return new ObjectType(getClassName(cpg));
  
public com.sun.org.apache.bcel.internal.generic.ObjectTypegetLoadClassType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

return
type of the referenced class/interface

    return getClassType(cpg);
  
public java.lang.StringgetName(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

return
name of referenced method/field.

    ConstantPool        cp   = cpg.getConstantPool();
    ConstantCP          cmr  = (ConstantCP)cp.getConstant(index);
    ConstantNameAndType cnat = (ConstantNameAndType)cp.getConstant(cmr.getNameAndTypeIndex());
    return ((ConstantUtf8)cp.getConstant(cnat.getNameIndex())).getBytes();
  
public java.lang.StringgetSignature(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

return
signature of referenced method/field.

    ConstantPool        cp   = cpg.getConstantPool();
    ConstantCP          cmr  = (ConstantCP)cp.getConstant(index);
    ConstantNameAndType cnat = (ConstantNameAndType)cp.getConstant(cmr.getNameAndTypeIndex());

    return ((ConstantUtf8)cp.getConstant(cnat.getSignatureIndex())).getBytes();