Fields Summary |
---|
private static final int | ACC_PUBLICAccess flag for a public class field |
private static final int | ACC_PRIVATEAccess flag for a private class field |
private static final int | ACC_PROTECTEDAccess flag for a protected class field |
private static final int | ACC_STATICAccess flag for a static class field |
private static final int | ACC_FINALAccess flag for a final class field |
private static final int | ACC_VOLATILEAccess flag for a volatile class field |
private static final int | ACC_TRANSIENTAccess flag for a transient class field |
private int | accessFlagsaccess flags for this field |
private int | nameIndexindex into constant pool with name of this field |
private int | descriptorIndexindex into constant pool with type of this field |
private int | attributesCountnumber of attributes this field has |
private AttributeInfo[] | attributesarray holding attributes of this field |
private ConstantPoolInfo[] | constantPoolthe constant pool for this class |
Methods Summary |
---|
public java.lang.String | getAccess()Returns the access permissions of this field in a text form.
String s = new String ("");
if ((accessFlags & ACC_PUBLIC) > 0)
s = s + "public ";
if ((accessFlags & ACC_PRIVATE) > 0)
s = s + "private ";
if ((accessFlags & ACC_PROTECTED) > 0)
s = s + "protected ";
if ((accessFlags & ACC_STATIC) > 0)
s = s + "static ";
if ((accessFlags & ACC_FINAL) > 0)
s = s + "final ";
if ((accessFlags & ACC_VOLATILE) > 0)
s = s + "volatile ";
if ((accessFlags & ACC_TRANSIENT) > 0)
s = s + "transient";
if (s.length () == 0)
s = "Not explicitly specified.";
return s;
|
public int | getAccessFlags()
return accessFlags;
|
public java.lang.String | getName()Query the name of this field.
//look up in the constant pool and return the name of this field
ConstantUtf8Info utf8Info;
utf8Info = (ConstantUtf8Info) constantPool[nameIndex];
return utf8Info.toString ();
|
public java.lang.String | getType()Query the type of this field (int, float, etc)
//look up the encoded type in the constant pool and parse it into
//it's full form
ConstantUtf8Info utf8Info;
utf8Info = (ConstantUtf8Info) constantPool[descriptorIndex];
return (utf8Info.toString ());
|
public java.lang.String | toString()Converts this field into a nice easy to read format for
displaying.
String s = new String ("");
ConstantUtf8Info utf8Info;
//first determine what access flags are set for this field
s = s + "Field:\n\tAccess Flags=\t";
s = s + getAccess ();
//get the name of this field
s = s + "\n\tName=\t\t" + getName ();
//get the type of this field
s = s + "\n\tClass=\t\t" + getType ();
//display all the attributes
for (int lcv = 0; lcv < attributesCount; ++lcv)
s = s + "\n\t" + attributes[lcv].toString ();
return s;
|