Package muntjac :: Package data :: Module buffered :: Class IBuffered
[hide private]
[frames] | no frames]

Class IBuffered

source code

object --+
         |
        IBuffered
Known Subclasses:

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


Authors:
Vaadin Ltd., Richard Lincoln

Version: 1.1.2

Instance Methods [hide private]
 
commit(self)
Updates all changes since the previous commit to the data source.
source code
 
discard(self)
Discards all changes since last commit.
source code
 
isWriteThrough(self)
Tests if the object is in write-through mode.
source code
 
setWriteThrough(self, writeThrough)
Sets the object's write-through mode to the specified status.
source code
 
isReadThrough(self)
Tests if the object is in read-through mode.
source code
 
setReadThrough(self, readThrough)
Sets the object's read-through mode to the specified status.
source code
 
isModified(self)
Tests if the value stored in the object has been modified since it was last updated from the data source.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

commit(self)

source code 

Updates all changes since the previous commit to the data source. The value stored in the object will always be updated into the data source when commit is called.

Raises:
  • SourceException - if the operation fails because of an exception is thrown by the data source. The cause is included in the exception.
  • InvalidValueException - if the operation fails because validation is enabled and the values do not validate

discard(self)

source code 

Discards all changes since last commit. The object updates its value from the data source.

Raises:
  • SourceException - if the operation fails because of an exception is thrown by the data source. The cause is included in the exception.

isWriteThrough(self)

source code 

Tests if the object is in write-through mode. If the object is in write-through mode, all modifications to it will result in commit being called after the modification.

Returns:
True if the object is in write-through mode, False if it's not.

setWriteThrough(self, writeThrough)

source code 

Sets the object's write-through mode to the specified status. When switching the write-through mode on, the commit operation will be performed.

Parameters:
  • writeThrough - Boolean value to indicate if the object should be in write-through mode after the call.
Raises:
  • SourceException - If the operation fails because of an exception is thrown by the data source.
  • InvalidValueException - If the implicit commit operation fails because of a validation error.

isReadThrough(self)

source code 

Tests if the object is in read-through mode. If the object is in read-through mode, retrieving its value will result in the value being first updated from the data source to the object.

The only exception to this rule is that when the object is not in write-through mode and it's buffer contains a modified value, the value retrieved from the object will be the locally modified value in the buffer which may differ from the value in the data source.

Returns:
True if the object is in read-through mode, False if it's not.

setReadThrough(self, readThrough)

source code 

Sets the object's read-through mode to the specified status. When switching read-through mode on, the object's value is updated from the data source.

Parameters:
  • readThrough - Boolean value to indicate if the object should be in read-through mode after the call.
Raises:
  • SourceException - If the operation fails because of an exception is thrown by the data source. The cause is included in the exception.

isModified(self)

source code 

Tests if the value stored in the object has been modified since it was last updated from the data source.

Returns:
True if the value in the object has been modified since the last data source update, False if not.