1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 37 public class NameAndType_info extends ConstantPoolEntry { 38 private int nameIndex; 39 private int typeIndex; 40 41 public NameAndType_info(ConstantPool constantPool, DataInputStream in) throws IOException { 42 super(constantPool); 43 44 nameIndex = in.readUnsignedShort(); 45 typeIndex = in.readUnsignedShort(); 46 } 47 48 public int getNameIndex() { 49 return nameIndex; 50 } 51 52 public UTF8_info getRawName() { 53 return (UTF8_info) getConstantPool().get(getNameIndex()); 54 } 55 56 public String getName() { 57 return getRawName().toString(); 58 } 59 60 public int getTypeIndex() { 61 return typeIndex; 62 } 63 64 public UTF8_info getRawType() { 65 return (UTF8_info) getConstantPool().get(getTypeIndex()); 66 } 67 68 public String getType() { 69 return getRawType().toString(); 70 } 71 72 public String toString() { 73 StringBuffer result = new StringBuffer (); 74 75 result.append(getName()).append(" -> ").append(getType()); 76 77 return result.toString(); 78 } 79 80 public void accept(Visitor visitor) { 81 visitor.visitNameAndType_info(this); 82 } 83 } 84 | Popular Tags |