1 7 package org.gjt.jclasslib.structures.elementvalues; 8 9 import org.gjt.jclasslib.structures.InvalidByteCodeException; 10 11 import java.io.*; 12 13 19 public class EnumElementValue extends ElementValue { 20 21 public final static String ENTRY_NAME = "EnumElement"; 22 23 private static final int LENGTH = 4; 24 private int typeNameIndex; 25 private int constNameIndex; 26 27 protected EnumElementValue() { 28 super(ENUM_TAG); 29 } 30 31 36 public int getTypeNameIndex() { 37 return this.typeNameIndex; 38 } 39 40 45 public void setTypeNameIndex(int typeNameIndex) { 46 this.typeNameIndex = typeNameIndex; 47 } 48 49 54 public int getConstNameIndex() { 55 return this.constNameIndex; 56 } 57 58 63 public void setConstNameIndex(int constNameIndex) { 64 this.constNameIndex = constNameIndex; 65 } 66 67 68 protected int getSpecificLength() { 69 return LENGTH; 70 } 71 72 public void read(DataInput in) throws InvalidByteCodeException, IOException { 73 super.read(in); 74 typeNameIndex = in.readUnsignedShort(); 75 constNameIndex = in.readUnsignedShort(); 76 77 if (debug) debug("read "); 78 } 79 80 public void write(DataOutput out) throws InvalidByteCodeException, IOException { 81 super.write(out); 82 out.writeShort(typeNameIndex); 83 out.writeShort(constNameIndex); 84 85 if (debug) debug("wrote "); 86 } 87 88 protected void debug(String message) { 89 super.debug(message + 90 "EnumElementValue with type_name_index " + 91 typeNameIndex + ", const_name_index " + constNameIndex); 92 93 } 94 95 public String getEntryName() { 96 return ENTRY_NAME; 97 } 98 99 } 100 | Popular Tags |