Package net.apartium.cocoabeans.state
Class LazyWatcher<T>
java.lang.Object
net.apartium.cocoabeans.state.LazyWatcher<T>
- Type Parameters:
T- T as type
- All Implemented Interfaces:
Observer
Watcher implementation that contains the last manually updated value.
Updating the value occurs through the
getOrUpdate() method-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> LazyWatcher<T>create(Observable<T> observable) voiddelete()voidflagAsDirty(Observable<?> observable) Flag listener as dirtyGet the value applied from lastgetOrUpdate()call.If the current watcher is dirty, update it if necessary, then return the new value.booleanisDirty()voidsetDependsOn(Observable<T> dependsOn)
-
Method Details
-
create
-
flagAsDirty
Description copied from interface:ObserverFlag listener as dirty- Specified by:
flagAsDirtyin interfaceObserver- Parameters:
observable- marking observable
-
setDependsOn
-
isDirty
public boolean isDirty() -
getLastValue
Get the value applied from lastgetOrUpdate()call.- Returns:
- last applied value
-
getOrUpdate
If the current watcher is dirty, update it if necessary, then return the new value.- Returns:
- entry containing the up-to-date value (key) and if it was changed since previous call (value).
-
delete
public void delete() -
getWatchedObservable
-