com.sun.data.provider.impl
Class IndexRowKey

java.lang.Object
  extended bycom.sun.data.provider.RowKey
      extended bycom.sun.data.provider.impl.IndexRowKey
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class IndexRowKey
extends RowKey

IndexRowKey uses an int index as the identifier for a data row in a TableDataProvider.

Author:
Joe Nuxoll Winston Prakash (Buf Fixes and clean up)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sun.data.provider.RowKey
EMPTY_ARRAY
 
Constructor Summary
IndexRowKey(int index)
          Constructs an IndexRowKey using the specified index
 
Method Summary
 int compareTo(java.lang.Object o)
          Compare this instance to another IndexRowKey instance.
static IndexRowKey create(java.lang.String rowId)
          Constructs a new IndexRowKey from the passed rowId String
 boolean equals(java.lang.Object o)
          Standard equals implementation.
 int getIndex()
          Returns the index of this IndexRowKey
 java.lang.String toString()
          Return a printable version of this instance.
 
Methods inherited from class com.sun.data.provider.RowKey
getRowId, setRowId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndexRowKey

public IndexRowKey(int index)
Constructs an IndexRowKey using the specified index

Parameters:
index - The desired index
Method Detail

create

public static IndexRowKey create(java.lang.String rowId)
                          throws java.lang.NumberFormatException
Constructs a new IndexRowKey from the passed rowId String

Parameters:
rowId - The cannonical row ID string to parse into an int
Returns:
An IndexRowKey representing the passed rowId
Throws:
java.lang.NumberFormatException - If the passed String is not parsable into an int

getIndex

public int getIndex()
Returns the index of this IndexRowKey

Returns:
This IndexRowKey's index value

compareTo

public int compareTo(java.lang.Object o)

Compare this instance to another IndexRowKey instance.

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.

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class RowKey

equals

public boolean equals(java.lang.Object o)
Standard equals implementation. This method compares the IndexRowKey index values for == equality. If the passed Object is not an IndexRowKey instance, the superclass (RowKey) gets a chance to evaluate the Object for equality. Standard equals implementation. This method compares the RowKey id values for equality.

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

toString

public java.lang.String toString()

Return a printable version of this instance.

Overrides:
toString in class RowKey