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:44:05 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   /**
00017    * Empty constructor needed for the Class.newInstance() statement in
00018    * Instruction.readInstruction(). Not to be used otherwise.
00019    */
00020   FieldInstruction() {}  
00021   /**
00022    * @param index to constant pool
00023    */
00024   protected FieldInstruction(short tag, int index) {
00025     super(tag, index);
00026   }  
00027   /** @return name of referenced field.
00028    */
00029   public String getFieldName(ConstantPoolGen cpg) {
00030     return getName(cpg);
00031   }  
00032   /** @return size of field (1 or 2)
00033    */
00034   protected int getFieldSize(ConstantPoolGen cpg) {
00035     return getType(cpg).getSize();
00036   }  
00037   /** @return type of field
00038    */
00039   public Type getFieldType(ConstantPoolGen cpg) {
00040     return Type.getType(getSignature(cpg));
00041   }  
00042   /** @return return type of referenced field
00043    */
00044   public Type getType(ConstantPoolGen cpg) {
00045     return getFieldType(cpg);
00046   }  
00047   /**
00048    * @return mnemonic for instruction with symbolic references resolved
00049    */
00050   public String toString(ConstantPool cp) {
00051     return OPCODE_NAMES[tag] + " " + cp.constantToString(index, CONSTANT_Fieldref);
00052   }  
00053 }

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