com.sun.data.provider
Class FieldKey

java.lang.Object
  extended bycom.sun.data.provider.FieldKey
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable
Direct Known Subclasses:
MapDataProvider.MapFieldKey

public class FieldKey
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

FieldKey is a representation of an identifier for a specific data element that may be retrieved from a DataProvider. Specialized implementations might also provide extra capabilities for navigation between elements, or other value added services.

FieldKey implements Comparable, to allow for sorting based on the displayName of the FieldKey. Note that the Comparable equals test may not correspond to the FieldKey.equals(...) test, as the Comparable implementation is working with the displayName, while the equals(...) method works with the fieldId.

Author:
Joe Nuxoll, Craig McClanahan
See Also:
Serialized Form

Field Summary
static FieldKey[] EMPTY_ARRAY
          A convenient static empty array to use for no-op method returns
 
Constructor Summary
FieldKey(java.lang.String fieldId)
          Constructs a new FieldKey with the specified cannonical ID.
FieldKey(java.lang.String fieldId, java.lang.String displayName)
          Constructs a new FieldKey with the specified cannonical ID and display name.
 
Method Summary
 int compareTo(java.lang.Object o)
          Standard compareTo implementation (for Comparable interface).
 boolean equals(java.lang.Object o)
          Standard equals implementation.
 java.lang.String getDisplayName()
           
 java.lang.String getFieldId()
           
 void setDisplayName(java.lang.String displayName)
           
 void setFieldId(java.lang.String fieldId)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_ARRAY

public static final FieldKey[] EMPTY_ARRAY
A convenient static empty array to use for no-op method returns

Constructor Detail

FieldKey

public FieldKey(java.lang.String fieldId)
Constructs a new FieldKey with the specified cannonical ID.

Parameters:
fieldId - The desired cannonical ID String

FieldKey

public FieldKey(java.lang.String fieldId,
                java.lang.String displayName)
Constructs a new FieldKey with the specified cannonical ID and display name.

Parameters:
fieldId - The desired cannonical ID String for this field
displayName - The desired display name String
Method Detail

setFieldId

public void setFieldId(java.lang.String fieldId)
Parameters:
fieldId - the canonical internal identifier of this FieldKey

getFieldId

public java.lang.String getFieldId()
Returns:
the canonical internal identifier of this FieldKey

setDisplayName

public void setDisplayName(java.lang.String displayName)
Parameters:
displayName - The display name for this data element, suitable for inclusion in a menu of available options.

getDisplayName

public java.lang.String getDisplayName()
Returns:
the display name for this data element, suitable for inclusion in a menu of available options.

equals

public boolean equals(java.lang.Object o)
Standard equals implementation. This method compares the FieldKey id values for equality.

Parameters:
o - the Object to check equality
Returns:
true if equal, false if not
See Also:
Object.equals(Object)

compareTo

public int compareTo(java.lang.Object o)
Standard compareTo implementation (for Comparable interface). This method compares FieldKeys for sorting by comparing the displayName values.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - Object to compare
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
See Also:
Comparable.compareTo(Object)

toString

public java.lang.String toString()