|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xorm.datastore.Row
A row represents a single instance of a data object. The structure of a Row is defined by its reference to a Table. The terms Row and Table could be changed to "Data Object" and "Datatype"; they were chosen to correspond to a relational database notion but are in no way tied to any particular implementation. A Row contains only primitive values; that is, there are no references to first class objects. When used with a relational database, an instance of the Row class is meant to correspond exactly with a single row in a database table. Foreign keys and primary keys are typically expressed as numeric IDs. Each instance of a Row tracks values for each Column specified for a Table. The column values may or may not have been loaded from persistent storage. This can be tested for using the containsValue() method. If the value has been set -- even to null -- containsValue() will return "true". A row also tracks dirty bits for each Column. A value is said to be dirty if it has been changed since the first time it was set. DatastoreDriver implementations are encouraged to use this information to optimize the update() operation. Finally, a Row is said to be "hollow" if no values other than the primary key have been set. Because it is possible to have a Table without a primary key (for example, a many-to-many table in a relational database), the getPrimaryKeyValue() method is not guaranteed to return a value.
Constructor Summary | |
Row(Table table)
Constructs a new, hollow row that references the given Table. |
|
Row(Table table,
Object primaryKey)
Constructs a new, hollow row with the given primary key. |
Method Summary | |
void |
clean()
Clears all dirty bits. |
Object |
clone()
Creates a clone of this Row's contents. |
boolean |
containsValue(Column column)
Returns true if the row contains a value for the given column, even if the value is null. |
boolean |
equals(Object o)
Tests row equality. |
Object |
getPrimaryKeyValue()
Convenience method. |
Table |
getTable()
Returns the Table that this Row is conceptually part of. |
Object |
getValue(Column column)
Get the value for the given column. |
boolean |
isCached()
Is this Row cached? |
boolean |
isDirty()
Returns true if any column values are dirty. |
boolean |
isDirty(Column column)
Returns true if the specified column value is dirty. |
boolean |
isHollow()
Returns true if the row is hollow. |
void |
makeDirty(Column column)
Explicitly makes a column dirty. |
void |
makeHollow()
Makes the Row hollow by clearing all values except the primaryKey. |
void |
setCached(boolean val)
Set the cached flag |
void |
setPrimaryKeyValue(Object value)
|
boolean |
setValue(Column column,
Object value)
Set the value for the given column. |
String |
toString()
|
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Row(Table table)
public Row(Table table, Object primaryKey)
Method Detail |
public Table getTable()
public boolean equals(Object o)
equals
in class Object
public String toString()
toString
in class Object
public Object clone()
clone
in class Object
public Object getValue(Column column)
public boolean containsValue(Column column)
public boolean setValue(Column column, Object value)
public void makeDirty(Column column)
public boolean isDirty(Column column)
public boolean isDirty()
public void clean()
public boolean isHollow()
public void makeHollow()
public Object getPrimaryKeyValue()
public void setPrimaryKeyValue(Object value)
public boolean isCached()
public void setCached(boolean val)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |