1 package com.sun.org.apache.bcel.internal.generic; 2 3 56 57 import com.sun.org.apache.bcel.internal.classfile.ConstantPool; 58 import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8; 59 import com.sun.org.apache.bcel.internal.classfile.ConstantNameAndType; 60 import com.sun.org.apache.bcel.internal.classfile.ConstantCP; 61 import com.sun.org.apache.bcel.internal.classfile.*; 62 63 69 public abstract class FieldInstruction extends FieldOrMethod 70 implements TypedInstruction { 71 75 FieldInstruction() {} 76 77 80 protected FieldInstruction(short opcode, int index) { 81 super(opcode, index); 82 } 83 84 87 public String toString(ConstantPool cp) { 88 return com.sun.org.apache.bcel.internal.Constants.OPCODE_NAMES[opcode] + " " + 89 cp.constantToString(index, com.sun.org.apache.bcel.internal.Constants.CONSTANT_Fieldref); 90 } 91 92 94 protected int getFieldSize(ConstantPoolGen cpg) { 95 return getType(cpg).getSize(); 96 } 97 98 100 public Type getType(ConstantPoolGen cpg) { 101 return getFieldType(cpg); 102 } 103 104 106 public Type getFieldType(ConstantPoolGen cpg) { 107 return Type.getType(getSignature(cpg)); 108 } 109 110 112 public String getFieldName(ConstantPoolGen cpg) { 113 return getName(cpg); 114 } 115 } 116 117 | Popular Tags |