com.sun.rowset.internal
Class Row

java.lang.Object
  extended bycom.sun.rowset.internal.BaseRow
      extended bycom.sun.rowset.internal.Row
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Row
extends BaseRow
implements java.io.Serializable, java.lang.Cloneable

A class that keeps track of a row's values. A Row object maintains an array of current column values and an array of original column values, and it provides methods for getting and setting the value of a column. It also keeps track of which columns have changed and whether the change was a delete, insert, or update.

Note that column numbers for rowsets start at 1, whereas the first element of an array or bitset is 0. The argument for the method getColumnUpdated refers to the column number in the rowset (the first column is 1); the argument for setColumnUpdated refers to the index into the rowset's internal bitset (the first bit is 0).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sun.rowset.internal.BaseRow
origVals
 
Constructor Summary
Row(int numCols)
          Creates a new Row object with the given number of columns.
Row(int numCols, java.lang.Object[] vals)
          Creates a new Row object with the given number of columns and with its array of original values initialized to the given array.
 
Method Summary
 void clearDeleted()
          Sets the deleted field for this Row object to false.
 void clearInserted()
          Sets the inserted field for this Row object to false.
 void clearUpdated()
          Sets the updated field for this Row object to false, sets all the column values in this Row object's internal array of current values to null, and clears all of the bits in the BitSet object maintained by this Row object.
 java.lang.Object getColumnObject(int columnIndex)
          Retrieves the column value stored in the designated column of this Row object.
 boolean getColUpdated(int idx)
          Indicates whether the designated column of this Row object has been changed.
 BaseRow getCurrentRow()
          Returns the row on which the cursor is positioned.
 boolean getDeleted()
          Retrieves the value of this Row object's deleted field, which will be true if one or more of its columns has been deleted.
 boolean getInserted()
          Retrieves the value of this Row object's inserted field, which will be true if this row has been inserted.
 boolean getUpdated()
          Retrieves the value of this Row object's updated field.
 void initColumnObject(int idx, java.lang.Object val)
          This method is called internally by the CachedRowSet.populate methods.
 void moveCurrentToOrig()
          Sets the column values in this Row object's internal array of original values with the values in its internal array of current values, sets all the values in this Row object's internal array of current values to null, clears all the bits in this Row object's internal bitset, and sets its updated field to false.
 void setColumnObject(int idx, java.lang.Object val)
          This method is called internally by the CachedRowSet.updateXXX methods.
 void setDeleted()
          Sets this Row object's deleted field to true.
 void setInserted()
          Sets the value of this Row object's inserted field to true.
 void setUpdated()
          Sets the updated field for this Row object to true if one or more of its column values has been changed.
 
Methods inherited from class com.sun.rowset.internal.BaseRow
getOrigRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Row

public Row(int numCols)
Creates a new Row object with the given number of columns. The newly-created row includes an array of original values, an array for storing its current values, and a BitSet object for keeping track of which column values have been changed.


Row

public Row(int numCols,
           java.lang.Object[] vals)
Creates a new Row object with the given number of columns and with its array of original values initialized to the given array. The new Row object also has an array for storing its current values and a BitSet object for keeping track of which column values have been changed.

Method Detail

initColumnObject

public void initColumnObject(int idx,
                             java.lang.Object val)
This method is called internally by the CachedRowSet.populate methods.

Parameters:
idx - the number of the column in this Row object that is to be set; the index of the first column is 1
val - the new value to be set

setColumnObject

public void setColumnObject(int idx,
                            java.lang.Object val)
This method is called internally by the CachedRowSet.updateXXX methods.

Specified by:
setColumnObject in class BaseRow
Parameters:
idx - the number of the column in this Row object that is to be set; the index of the first column is 1
val - the new value to be set

getColumnObject

public java.lang.Object getColumnObject(int columnIndex)
                                 throws java.sql.SQLException
Retrieves the column value stored in the designated column of this Row object.

Specified by:
getColumnObject in class BaseRow
Parameters:
columnIndex - the index of the column value to be retrieved; the index of the first column is 1
Returns:
an Object in the Java programming language that represents the value stored in the designated column
Throws:
java.sql.SQLException - if there is a database access error

getColUpdated

public boolean getColUpdated(int idx)
Indicates whether the designated column of this Row object has been changed.

Parameters:
idx - the index into the BitSet object maintained by this Row object to keep track of which column values have been modified; the index of the first bit is 0
Returns:
true if the designated column value has been changed; false otherwise

setDeleted

public void setDeleted()
Sets this Row object's deleted field to true.

See Also:
getDeleted()

getDeleted

public boolean getDeleted()
Retrieves the value of this Row object's deleted field, which will be true if one or more of its columns has been deleted.

Returns:
true if a column value has been deleted; false otherwise
See Also:
setDeleted()

clearDeleted

public void clearDeleted()
Sets the deleted field for this Row object to false.


setInserted

public void setInserted()
Sets the value of this Row object's inserted field to true.

See Also:
getInserted()

getInserted

public boolean getInserted()
Retrieves the value of this Row object's inserted field, which will be true if this row has been inserted.

Returns:
true if this row has been inserted; false otherwise
See Also:
setInserted()

clearInserted

public void clearInserted()
Sets the inserted field for this Row object to false.


getUpdated

public boolean getUpdated()
Retrieves the value of this Row object's updated field.

Returns:
true if this Row object has been updated; false if it has not
See Also:
setUpdated()

setUpdated

public void setUpdated()
Sets the updated field for this Row object to true if one or more of its column values has been changed.

See Also:
getUpdated()

clearUpdated

public void clearUpdated()
Sets the updated field for this Row object to false, sets all the column values in this Row object's internal array of current values to null, and clears all of the bits in the BitSet object maintained by this Row object.


moveCurrentToOrig

public void moveCurrentToOrig()
Sets the column values in this Row object's internal array of original values with the values in its internal array of current values, sets all the values in this Row object's internal array of current values to null, clears all the bits in this Row object's internal bitset, and sets its updated field to false.

This method is called internally by the CachedRowSet method makeRowOriginal.


getCurrentRow

public BaseRow getCurrentRow()
Returns the row on which the cursor is positioned.

Returns:
the Row object on which the CachedRowSet implementation objects's cursor is positioned