|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines the interface to commit and discard changes to an object, supporting read-through and write-through modes.
Read-through mode means that the value read from the buffered object is constantly up to date with the data source. Write-through mode means that all changes to the object are immediately updated to the data source.
Since these modes are independent, their combinations may result in
some behaviour that may sound surprising. For example, if a
Buffered
object is in read-through mode but not in
write-through mode, the result is an object whose value is updated
directly from the data source only if it's not locally modified. If the
value is locally modified, retrieving the value from the object would
result in a value that is different than the one stored in the data
source, even though the object is in read-through mode.
Nested Class Summary | |
static class |
Buffered.SourceException
An exception that signals that one or more exceptions occurred while a buffered object tried to access its data source. |
Method Summary | |
void |
commit()
Updates all changes since the previous commit to the data source. |
void |
discard()
Discards all changes since last commit. |
boolean |
isModified()
Tests if the value stored in the object has been modified since it was last updated from the data source. |
boolean |
isReadThrough()
Tests if the object is in read-through mode. |
boolean |
isWriteThrough()
Tests if the object is in write-through mode. |
void |
setReadThrough(boolean readThrough)
Sets the object's read-through mode to the specified status. |
void |
setWriteThrough(boolean writeThrough)
Sets the object's write-through mode to the specified status. |
Method Detail |
public void commit() throws Buffered.SourceException
commit
is called.
Buffered.SourceException
- if the operation fails because of an
exception is thrown by the data source. The cause is included in the
exception.public void discard() throws Buffered.SourceException
Buffered.SourceException
- if the operation fails because of an
exception is thrown by the data source. The cause is included in the
exception.public boolean isWriteThrough()
commit
being called after the modification.
true
if the object is in write-through mode,
false
if it's not.public void setWriteThrough(boolean writeThrough) throws Buffered.SourceException
commit()
operation will be performed.
writeThrough
- Boolean value to indicate if the object should be
in write-through mode after the call.
Buffered.SourceException
public boolean isReadThrough()
true
if the object is in read-through mode,
false
if it's not.public void setReadThrough(boolean readThrough) throws Buffered.SourceException
readThrough
- Boolean value to indicate if the object should be
in read-through mode after the call.
Buffered.SourceException
- if the operation fails because of an
exception is thrown by the data source. The cause is included in the
exception.public boolean isModified()
true
if the value in the object has been
modified since the last data source update, false
if
not.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |