FileDocCategorySizeDatePackage
ClassField.javaAPI DocGlassfish v2 API4930Fri May 04 22:34:28 BST 2007com.sun.jdo.api.persistence.enhancer.classfile

ClassField

public final class ClassField extends ClassMember
ClassField models the static and non-static fields of a class within a class file.

Fields Summary
private int
accessFlags
private ConstUtf8
fieldName
private ConstUtf8
fieldSignature
private AttributeVector
fieldAttributes
Constructors Summary
public ClassField(int accFlags, ConstUtf8 name, ConstUtf8 sig, AttributeVector field_attrs)
Construct a class field object

    accessFlags = accFlags;
    fieldName = name;
    fieldSignature = sig;
    fieldAttributes = field_attrs;
  
Methods Summary
public intaccess()
Return the access flags for the field - see VMConstants

    return accessFlags;
  
public AttributeVectorattributes()
Return the attributes associated with the field

    return fieldAttributes;
  
public voidchangeName(ConstUtf8 name)
Change the name of the field

    fieldName = name;
  
public voidchangeSignature(ConstUtf8 newSig)
Change the type signature of the field

    fieldSignature = newSig;
  
public booleanisTransient()
Is the field transient?

    return (accessFlags & ACCTransient) != 0;
  
public ConstUtf8name()
Return the name of the field

    return fieldName;
  
voidprint(java.io.PrintStream out, int indent)

    ClassPrint.spaces(out, indent);
    out.print("'" + fieldName.asString() + "'");//NOI18N
    out.print(" sig = " + fieldSignature.asString());//NOI18N
    out.print(" access_flags = " + Integer.toString(accessFlags));//NOI18N
    out.println(" attributes:");//NOI18N
    fieldAttributes.print(out, indent+2);
  
static com.sun.jdo.api.persistence.enhancer.classfile.ClassFieldread(java.io.DataInputStream data, ConstantPool pool)

    ClassField f = null;
    int accessFlags = data.readUnsignedShort();
    int name_index = data.readUnsignedShort();
    int sig_index = data.readUnsignedShort();
    AttributeVector fieldAttribs = AttributeVector.readAttributes(data, pool);
    f = new ClassField(accessFlags, 
		       (ConstUtf8) pool.constantAt(name_index),
		       (ConstUtf8) pool.constantAt(sig_index),
		       fieldAttribs);
    return f;
  
public voidsetAccess(int newFlags)
Update the access flags for the field - see VMConstants

    accessFlags = newFlags;
  
public ConstUtf8signature()
Return the type signature of the field

    return fieldSignature;
  
voidwrite(java.io.DataOutputStream data)

    data.writeShort(accessFlags);
    data.writeShort(fieldName.getIndex());
    data.writeShort(fieldSignature.getIndex());
    fieldAttributes.write(data);