public final class SimpleDataController extends Object implements AsyncDataController
AsyncDataController implementation which stores a volatile
reference to an AsyncDataState but otherwise does nothing.
The getDataState method returns the currently set
reference to the state of progress.
Note that it is safer to wrap instances of this class in a
DelegatedAsyncDataController before sharing it with external code,
so the external code will be unable to modify the state of progress.
state of progress if it is mutable. In case the
state of progress is immutable (and it is recommended to be so), then the
SimpleDataController instance is completely immutable.
DelegatedAsyncDataController| Constructor and Description |
|---|
SimpleDataController()
|
SimpleDataController(AsyncDataState firstState)
Initializes the
SimpleDataController with the specified
state of progress. |
| Modifier and Type | Method and Description |
|---|---|
void |
controlData(Object controlArg)
This method does nothing and returns immediately to the caller.
|
AsyncDataState |
getDataState()
Returns the
AsyncDataState object which was last set by the
setDataState() method or the one
specified at construction time if there was no setDataState()
call yet. |
void |
setDataState(AsyncDataState newState)
Sets the volatile reference to the stored
AsyncDataState to the
one specified. |
public SimpleDataController()
SimpleDataController with null as
the state of progress.
Until setDataState has been called,
null will be returned by the getDataState
method.
public SimpleDataController(AsyncDataState firstState)
SimpleDataController with the specified
state of progress.firstState - the AsyncDataState which will be returned by
the getDataState() method until
setDataState has been called.
This argument can be null.public void setDataState(AsyncDataState newState)
AsyncDataState to the
one specified. Subsequent calls the
getDataState() method will return the state
specified.newState - the AsyncDataState which is to be returned by the
getDataState() method. This argument can be
null.public void controlData(Object controlArg)
controlData in interface AsyncDataControllercontrolArg - this argument is ignoredpublic AsyncDataState getDataState()
AsyncDataState object which was last set by the
setDataState() method or the one
specified at construction time if there was no setDataState()
call yet.getDataState in interface AsyncDataControllerAsyncDataState which was last set by the
setDataState() method or the one
specified at construction time if there was no setDataState()
call yet. This method may return null if null was set.