Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

FieldInstruction.java

00001 package de.fub.bytecode.generic;
00002 
00003 import de.fub.bytecode.classfile.ConstantPool;
00004 import de.fub.bytecode.classfile.ConstantUtf8;
00005 import de.fub.bytecode.classfile.ConstantNameAndType;
00006 import de.fub.bytecode.classfile.ConstantCP;
00007 import de.fub.bytecode.classfile.*;
00008 
00009 /**
00010  * Super class for the GET/PUTxxx family of instructions.
00011  *
00012  * @version $Id: FieldInstruction.java,v 1.1.1.1 2002/01/24 03:41:39 pserver Exp $
00013  * @author  <A HREF="http://www.inf.fu-berlin.de/~dahm">M. Dahm</A>
00014  */
00015 public abstract class FieldInstruction extends FieldOrMethod
00016   implements TypedInstruction {
00017   /**
00018    * Empty constructor needed for the Class.newInstance() statement in
00019    * Instruction.readInstruction(). Not to be used otherwise.
00020    */
00021   FieldInstruction() {}  
00022   /**
00023    * @param index to constant pool
00024    */
00025   protected FieldInstruction(short tag, int index) {
00026     super(tag, index);
00027   }  
00028   /** @return name of referenced field.
00029    */
00030   public String getFieldName(ConstantPoolGen cpg) {
00031     return getName(cpg);
00032   }  
00033   /** @return size of field (1 or 2)
00034    */
00035   protected int getFieldSize(ConstantPoolGen cpg) {
00036     return getType(cpg).getSize();
00037   }  
00038   /** @return type of field
00039    */
00040   public Type getFieldType(ConstantPoolGen cpg) {
00041     return Type.getType(getSignature(cpg));
00042   }  
00043   /** @return return type of referenced field
00044    */
00045   public Type getType(ConstantPoolGen cpg) {
00046     return getFieldType(cpg);
00047   }  
00048   /**
00049    * @return mnemonic for instruction with symbolic references resolved
00050    */
00051   public String toString(ConstantPool cp) {
00052     return de.fub.bytecode.Constants.OPCODE_NAMES[tag] + " " +
00053       cp.constantToString(index, de.fub.bytecode.Constants.CONSTANT_Fieldref);
00054   }  
00055 }

Generated at Thu Feb 7 06:45:39 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001