1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 import java.util.*; 37 38 public class Field_info extends Feature_info { 39 public static final int ACC_VOLATILE = 0x0040; 40 public static final int ACC_TRANSIENT = 0x0080; 41 42 public Field_info(Classfile classfile, DataInputStream in) throws IOException { 43 super(classfile, in); 44 } 45 46 public String getFeatureType() { 47 return "field"; 48 } 49 50 public boolean isVolatile() { 51 return (getAccessFlag() & ACC_VOLATILE) != 0; 52 } 53 54 public boolean isTransient() { 55 return (getAccessFlag() & ACC_TRANSIENT) != 0; 56 } 57 58 public String getType() { 59 return SignatureHelper.getType(getDescriptor()); 60 } 61 62 public String getDeclaration() { 63 StringBuffer result = new StringBuffer (); 64 65 if (isPublic()) result.append("public "); 66 if (isProtected()) result.append("protected "); 67 if (isPrivate()) result.append("private "); 68 if (isStatic()) result.append("static "); 69 if (isFinal()) result.append("final "); 70 if (isVolatile()) result.append("volatile "); 71 if (isTransient()) result.append("transient "); 72 73 result.append(getType()).append(" "); 74 result.append(getName()); 75 76 return result.toString(); 77 } 78 79 public String getSignature() { 80 return getName(); 81 } 82 83 public void accept(Visitor visitor) { 84 visitor.visitField_info(this); 85 } 86 } 87 | Popular Tags |