|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.data.provider.RowKey
RowKey is a representation of an identifier for a specific data row that
may be retrieved from a TableDataProvider
. Specialized
implementations might also provide extra capabilities for navigation
between rows, or other value added services.
A RowKey (and rowId) is expected to remain valid for as long as possible - meaning when a RowKey is fetched from a TableDataProvider, it is considered an address of a particular row in that TableDataProvider. If rows have been added or removed from the TableDataProvider, a previously fetched RowKey should still represent the row it did when it was first retrieved. A common strategy for TableDataProvider implementations is to store intrinsicly "primary key-like" data from the underlying data source inside of a specialized RowKey implementation. Another strategy is to store a random hash index in the RowKeys, and maintain a map inside the TableDataProvider implementation to resolve the RowKeys back to the underlying data rows. This insolates consumers of the TableDataProvider implementation from row index changes (due to inserts, deletes, etc) in the underlying data source.
At any point a user might call TableDataProvider.getRowKey(String)
in order to fetch a valid RowKey for a particular rowId, so the
TableDataProvider must be capable of resolving a rowId back to a unique
RowKey.
RowKey implements Comparable so that batched deletes and inserts can be done in reverse order to help ensure consistency of row order. This is only for blind operations implemented where there is no knowledge of a specific RowKey or TableDataProvider implementations. A RowKey implementation might not support intrinsic ordering of any type.
Field Summary | |
static RowKey[] |
EMPTY_ARRAY
A convenient static empty array to use for no-op method returns |
Constructor Summary | |
RowKey()
Constructs an uninitialized RowKey. |
|
RowKey(java.lang.String rowId)
Constructs a new RowKey with the specified cannonical ID. |
Method Summary | |
int |
compareTo(java.lang.Object o)
Standard implementation of compareTo(Object). |
boolean |
equals(java.lang.Object o)
Standard equals implementation. |
java.lang.String |
getRowId()
|
void |
setRowId(java.lang.String rowId)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final RowKey[] EMPTY_ARRAY
Constructor Detail |
public RowKey()
public RowKey(java.lang.String rowId)
rowId
- The desired cannonical ID StringMethod Detail |
public void setRowId(java.lang.String rowId)
rowId
- the canonical internal identifier of this RowKey
public java.lang.String getRowId()
RowKey
public boolean equals(java.lang.Object o)
o
- the Object to check equality
Object.equals(Object)
public int compareTo(java.lang.Object o)
Standard implementation of compareTo(Object). This checks for equality first (using equals(Object)), then compares the rowId strings. This should be overridden by RowKey implementations that have a notion of order. This allows for deletions and insertions to be done in reverse order to help ensure the longevity of valid RowKeys.
compareTo
in interface java.lang.Comparable
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |