1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 37 import org.apache.log4j.*; 38 39 public class ConstantValue_attribute extends Attribute_info { 40 private int valueIndex; 41 42 public ConstantValue_attribute(Classfile classfile, Visitable owner, DataInputStream in) throws IOException { 43 super(classfile, owner); 44 45 int byteCount = in.readInt(); 46 Logger.getLogger(getClass()).debug("Attribute length: " + byteCount); 47 48 valueIndex = in.readUnsignedShort(); 49 Logger.getLogger(getClass()).debug("Constant value: " + getRawValue()); 50 } 51 52 public int getValueIndex() { 53 return valueIndex; 54 } 55 56 public ConstantPoolEntry getRawValue() { 57 return (ConstantPoolEntry) getClassfile().getConstantPool().get(getValueIndex()); 58 } 59 60 public String toString() { 61 return "ConstantValue " + getRawValue(); 62 } 63 64 public void accept(Visitor visitor) { 65 visitor.visitConstantValue_attribute(this); 66 } 67 } 68 | Popular Tags |