harpoon.ClassFile
Interface HField

All Superinterfaces:
Comparable<HMember>, HMember

public interface HField
extends HMember

A HField provides information about a single field of a class or an interface. The reflected field may be a class (static) field or an instance field.

Version:
$Id: HField.java,v 1.19 2003/03/18 03:52:53 salcianu Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>
See Also:
HMember, HClass

Nested Class Summary
 
Nested classes/interfaces inherited from interface harpoon.ClassFile.HMember
HMember.MemberComparator
 
Field Summary
static ArrayFactory<HField> arrayFactory
          Array factory: returns new HField[].
 
Fields inherited from interface harpoon.ClassFile.HMember
memberComparator
 
Method Summary
 boolean equals(Object object)
          Compares this HField against the specified object.
 Object getConstant()
          Returns the constant value of this HField, if it is a constant field.
 HClass getDeclaringClass()
          Returns the HClass object representing the class or interface that declares the field represented by this HField object.
 String getDescriptor()
          Return the type descriptor for this HField object.
 HType getGenericType()
          Returns an HType object that represents the declared compile-time type for the field represented by this HField object.
 int getModifiers()
          Returns the Java language modifiers for the field represented by this HField object, as an integer.
 HFieldMutator getMutator()
          Returns a mutator for this HField, or null if the object is immutable.
 String getName()
          Returns the name of the field represented by this HField object.
 HClass getType()
          Returns an HClass object that identifies the declared type for the field represented by this HField object.
 boolean isConstant()
          Determines whether this HField represents a constant field.
 boolean isStatic()
          Determines whether this is a static field.
 boolean isSynthetic()
          Determines whether this HField is synthetic.
 String toString()
          Return a string describing this HField.
 
Methods inherited from interface harpoon.ClassFile.HMember
compareTo, hashCode
 

Field Detail

arrayFactory

static final ArrayFactory<HField> arrayFactory
Array factory: returns new HField[].

Method Detail

getDeclaringClass

HClass getDeclaringClass()
Returns the HClass object representing the class or interface that declares the field represented by this HField object.

Specified by:
getDeclaringClass in interface HMember

getName

String getName()
Returns the name of the field represented by this HField object.

Specified by:
getName in interface HMember

getModifiers

int getModifiers()
Returns the Java language modifiers for the field represented by this HField object, as an integer. The Modifier class should be used to decode the modifiers.

Specified by:
getModifiers in interface HMember
See Also:
Modifier

getType

HClass getType()
Returns an HClass object that identifies the declared type for the field represented by this HField object.


getDescriptor

String getDescriptor()
Return the type descriptor for this HField object. The format of a field string descriptor is defined in Section 4.3 of the JVM specification.

Specified by:
getDescriptor in interface HMember

getConstant

Object getConstant()
Returns the constant value of this HField, if it is a constant field.

Returns:
the wrapped value, or null if !isConstant().
See Also:
HClass.getWrapper(harpoon.ClassFile.Linker)

isConstant

boolean isConstant()
Determines whether this HField represents a constant field.


isSynthetic

boolean isSynthetic()
Determines whether this HField is synthetic.

Specified by:
isSynthetic in interface HMember

isStatic

boolean isStatic()
Determines whether this is a static field.


getMutator

HFieldMutator getMutator()
Returns a mutator for this HField, or null if the object is immutable.


equals

boolean equals(Object object)
Compares this HField against the specified object. Returns true if the objects are the same. Two HFields are the same if they were declared by the same class and have the same name and type.

Overrides:
equals in class Object

toString

String toString()
Return a string describing this HField. The format is the access modifiers for the field, if any, followed by the field type, followed by a space, followed by the fully-qualified name of the class declaring the field, followed by a period, followed by the name of the field. For example:

public static final int java.lang.Thread.MIN_PRIORITY
private int java.io.FileDescriptor.fd

The modifiers are placed in canonical order as specified by "The Java Language Specification." This is public, protected, or private first, and then other modifiers in the following order: static, final, transient, volatile.

Overrides:
toString in class Object

getGenericType

HType getGenericType()
Returns an HType object that represents the declared compile-time type for the field represented by this HField object. In particular, if the compile-time type of this field is a type variable or a parameterized type, than an object of the appropriate type (i.e., HTypeVariable or HParameterizedType) will be returned.