public final class Observable
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Observable.Function |
static interface |
Observable.Observer |
static interface |
Observable.Predicate |
Constructor and Description |
---|
Observable(java.lang.Object initialValue)
Creates a new observable from an initial value.
|
Modifier and Type | Method and Description |
---|---|
Observable |
filter(Observable.Predicate predicate)
Creates an observer that filters the values of this observable.
|
java.lang.Object |
get()
Gets the current value.
|
Observable |
map(Observable.Function function)
Creates an observer that maps the values of this observable.
|
Observable |
onChange(Observable.Observer observer)
Registers an observer.
|
void |
set(java.lang.Object newValue)
Changes the current value and notifies all observers.
|
java.lang.String |
toString() |
public Observable(java.lang.Object initialValue)
initialValue
- the initial value.public java.lang.Object get()
public void set(java.lang.Object newValue)
newValue
- the new value.public Observable onChange(Observable.Observer observer)
observer
- an observer.public Observable filter(Observable.Predicate predicate)
predicate
- a predicate function.public Observable map(Observable.Function function)
function
- a mapping function.public java.lang.String toString()
toString
in class java.lang.Object