APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.rowset.internal

public Class Row

extends BaseRow
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Imports
java.sql.*, java.io.*, java.lang.*, java.util.*

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).

Field Summary

Modifier and TypeField and Description
private BitSet
colsChanged

A BitSet object containing a flag for each column in this Row object, with each flag indicating whether or not the value in the column has been changed.

private Object[]
currentVals

An array containing the current column values for this Row object.

private boolean
deleted

A boolean indicating whether or not this Row object has been deleted.

private boolean
inserted

A boolean indicating whether or not this Row object has been inserted.

private int
numCols

The number of columns in this Row object.

pack-priv static final long
private boolean
updated

A boolean indicating whether or not this Row object has been updated.

Inherited from com.sun.rowset.internal.BaseRow:
origVals

Constructor Summary

AccessConstructor and Description
public
Row(int numCols)

Creates a new Row object with the given number of columns.

public
Row(int numCols, 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

Modifier and TypeMethod and Description
public void
clearDeleted()

Sets the deleted field for this Row object to false.

public void
clearInserted()

Sets the inserted field for this Row object to false.

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.

public Object

Returns:

an Object in the Java programming language that represents the value stored in the designated column
getColumnObject
(int
the index of the column value to be retrieved; the index of the first column is 1
columnIndex
)

Implements abstract com.sun.rowset.internal.BaseRow.getColumnObject.

Retrieves the column value stored in the designated column of this Row object.

public boolean

Returns:

true if the designated column value has been changed; false otherwise
getColUpdated
(int
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
idx
)

Indicates whether the designated column of this Row object has been changed.

public BaseRow

Returns:

the Row object on which the CachedRowSet implementation objects's cursor is positioned
getCurrentRow
()

Returns the row on which the cursor is positioned.

public boolean

Returns:

true if a column value has been deleted; false otherwise
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.

public boolean

Returns:

true if this row has been inserted; false otherwise
getInserted
()

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

public boolean

Returns:

true if this Row object has been updated; false if it has not
getUpdated
()

Retrieves the value of this Row object's updated field.

public void
initColumnObject(int
the number of the column in this Row object that is to be set; the index of the first column is 1
idx
,
Object
the new value to be set
val
)

This method is called internally by the CachedRowSet.populate methods.

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.

public void
setColumnObject(int
the number of the column in this Row object that is to be set; the index of the first column is 1
idx
,
Object
the new value to be set
val
)

Implements abstract com.sun.rowset.internal.BaseRow.setColumnObject.

This method is called internally by the CachedRowSet.updateXXX methods.

private void
setColUpdated(int
the index into the BitSet object maintained by this Row object; the first bit is at index 0
idx
)

Sets the bit at the given index into this Row object's internal BitSet object, indicating that the corresponding column value (column idx + 1) has been changed.

public void
setDeleted()

Sets this Row object's deleted field to true.

public void
setInserted()

Sets the value of this Row object's inserted field to true.

public void
setUpdated()

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

Inherited from com.sun.rowset.internal.BaseRow:
getOrigRow

Field Detail

colsChangedback to summary
private BitSet colsChanged

A BitSet object containing a flag for each column in this Row object, with each flag indicating whether or not the value in the column has been changed.

currentValsback to summary
private Object[] currentVals

An array containing the current column values for this Row object.

Annotations
@SuppressWarnings:serial
deletedback to summary
private boolean deleted

A boolean indicating whether or not this Row object has been deleted. true indicates that it has been deleted; false indicates that it has not.

insertedback to summary
private boolean inserted

A boolean indicating whether or not this Row object has been inserted. true indicates that it has been inserted; false indicates that it has not.

numColsback to summary
private int numCols

The number of columns in this Row object.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides com.sun.rowset.internal.BaseRow.serialVersionUID.

updatedback to summary
private boolean updated

A boolean indicating whether or not this Row object has been updated. true indicates that it has been updated; false indicates that it has not.

Constructor Detail

Rowback to summary
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.

Rowback to summary
public Row(int numCols, 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

clearDeletedback to summary
public void clearDeleted()

Sets the deleted field for this Row object to false.

clearInsertedback to summary
public void clearInserted()

Sets the inserted field for this Row object to false.

clearUpdatedback to summary
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.

getColumnObjectback to summary
public Object getColumnObject(int columnIndex) throws SQLException

Implements abstract com.sun.rowset.internal.BaseRow.getColumnObject.

Retrieves the column value stored in the designated column of this Row object.

Parameters
columnIndex:int

the index of the column value to be retrieved; the index of the first column is 1

Returns:Object

an Object in the Java programming language that represents the value stored in the designated column

Exceptions
SQLException:
if there is a database access error
getColUpdatedback to summary
public boolean getColUpdated(int idx)

Indicates whether the designated column of this Row object has been changed.

Parameters
idx:int

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:boolean

true if the designated column value has been changed; false otherwise

getCurrentRowback to summary
public BaseRow getCurrentRow()

Returns the row on which the cursor is positioned.

Returns:BaseRow

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

getDeletedback to summary
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:boolean

true if a column value has been deleted; false otherwise

See Also
setDeleted
getInsertedback to summary
public boolean getInserted()

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

Returns:boolean

true if this row has been inserted; false otherwise

See Also
setInserted
getUpdatedback to summary
public boolean getUpdated()

Retrieves the value of this Row object's updated field.

Returns:boolean

true if this Row object has been updated; false if it has not

See Also
setUpdated
initColumnObjectback to summary
public void initColumnObject(int idx, Object val)

This method is called internally by the CachedRowSet.populate methods.

Parameters
idx:int

the number of the column in this Row object that is to be set; the index of the first column is 1

val:Object

the new value to be set

moveCurrentToOrigback to summary
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.

setColumnObjectback to summary
public void setColumnObject(int idx, Object val)

Implements abstract com.sun.rowset.internal.BaseRow.setColumnObject.

This method is called internally by the CachedRowSet.updateXXX methods.

Parameters
idx:int

the number of the column in this Row object that is to be set; the index of the first column is 1

val:Object

the new value to be set

setColUpdatedback to summary
private void setColUpdated(int idx)

Sets the bit at the given index into this Row object's internal BitSet object, indicating that the corresponding column value (column idx + 1) has been changed.

Parameters
idx:int

the index into the BitSet object maintained by this Row object; the first bit is at index 0

setDeletedback to summary
public void setDeleted()

Sets this Row object's deleted field to true.

See Also
getDeleted
setInsertedback to summary
public void setInserted()

Sets the value of this Row object's inserted field to true.

See Also
getInserted
setUpdatedback to summary
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