Sun SPOT API
Green Release  


com.sun.squawk
Class Field

java.lang.Object
  extended by com.sun.squawk.Member
      extended by com.sun.squawk.Field

public final class Field
extends Member

An instance of Field encapsulates the information about the field of a class. This includes the name of the field, its type, access flags etc.

Author:
Doug Simon

Method Summary
 long getPrimitiveConstantValue()
          Gets the primitive constant value of this static field.
 String getStringConstantValue()
          Gets the String constant value of this static field.
 Klass getType()
          Gets this declared type of this field.
 boolean hasConstant()
          Determines if this field had a ConstantValue attribute in its class file definition.
 boolean isTransient()
          Determines if this field is transient.
 
Methods inherited from class com.sun.squawk.Member
getDefiningClass, getFullyQualifiedName, getModifiers, getName, getOffset, hashCode, isAccessibleFrom, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isSourceSynthetic, isStatic, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

isTransient

public boolean isTransient()
Determines if this field is transient.

Returns:
true if this field is transient

hasConstant

public boolean hasConstant()
Determines if this field had a ConstantValue attribute in its class file definition. Note that this does not necessarily mean that the field is 'final'.

Returns:
if there is a constant value associated with this field

getType

public Klass getType()
Gets this declared type of this field.

Returns:
this declared type of this field

getStringConstantValue

public String getStringConstantValue()
                              throws IllegalArgumentException
Gets the String constant value of this static field.

Returns:
the value derived from the ConstantValue classfile attribute
Throws:
IllegalArgumentException - if this field did not have a ConstantValue attribute in its class file or if the constant is not a String

getPrimitiveConstantValue

public long getPrimitiveConstantValue()
                               throws IllegalArgumentException
Gets the primitive constant value of this static field.

Returns:
the value derived from the ConstantValue classfile attribute
Throws:
IllegalArgumentException - if this field did not have a ConstantValue attribute in its class file or if the constant is not a primitive value

Sun SPOT API
Green Release  


Copyright © 2006 Sun Microsystems, Inc. All Rights Reserved.