1 package alt.jiapi.file; 2 3 import java.util.List ; 4 5 9 public class Field { 10 public static final short ACC_PUBLIC = 0x0001; 11 public static final short ACC_PRIVATE = 0x0002; 12 public static final short ACC_PROTECTED = 0x0004; 13 public static final short ACC_STATIC = 0x0008; 14 public static final short ACC_FINAL = 0x0010; 15 public static final short ACC_VOLATILE = 0x0040; 16 public static final short ACC_TRANSIENT = 0x0080; 17 18 private ConstantPool cp; 19 20 private short access_flags; 21 private short name_index; 22 private short descriptor_index; 23 private List attributes; 24 25 private transient Configuration config = new Configuration(); 26 27 public Field(ConstantPool cp, short access_flags, String name, 28 String descriptor, List attributes) { 29 this(cp, access_flags, cp.addUtf8Info(name).getEntryIndex(), 30 cp.addUtf8Info(descriptor).getEntryIndex(), attributes); 31 } 32 33 Field(ConstantPool cp, short access_flags, short name_index, 34 short descriptor_index, List attributes) { 35 this.cp = cp; 36 this.access_flags = access_flags; 37 this.name_index = name_index; 38 this.descriptor_index = descriptor_index; 39 this.attributes = attributes; 40 } 41 42 public short getAccessFlags() { 43 return access_flags; 44 } 45 46 public List getAttributes() { 47 if (config.getBoolean("alt.jiapi.file.strip-optional-attributes",true)){ 48 return new java.util.LinkedList (); 49 } 50 51 return attributes; 52 } 53 54 57 public String getName() { 58 return cp.getUtf8(name_index); 59 } 60 61 64 public String getDescriptor() { 65 return cp.getUtf8(descriptor_index); 66 } 67 68 short getNameIndex() { 69 return name_index; 70 } 71 short getDescriptorIndex() { 72 return descriptor_index; 73 } 74 } 75 76 77 78 79 | Popular Tags |