Package org.patternfly.core
Class ObservableValue<T>
- java.lang.Object
-
- org.patternfly.core.ObservableValue<T>
-
public class ObservableValue<T> extends Object
Inspired by FrontendMasters/obervablish-values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceObservableValue.Subscriber<T>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchange(T value)Sets the value of the ObservableValue to the specified value and notifies subscribers regardless of whether the value has changed.Tget()static <T> ObservableValue<T>ov(T initial)voidpublish()voidset(T value)Sets the value of the ObservableValue and notifies subscribers if the value has changed.voidsilent(T value)Sets the value of the ObservableValue, but does not notify subscribers.ObservableValue<T>subscribe(ObservableValue.Subscriber<T> fn)
-
-
-
Method Detail
-
ov
public static <T> ObservableValue<T> ov(T initial)
-
get
public T get()
-
silent
public void silent(T value)
Sets the value of the ObservableValue, but does not notify subscribers.
-
set
public void set(T value)
Sets the value of the ObservableValue and notifies subscribers if the value has changed.
-
change
public void change(T value)
Sets the value of the ObservableValue to the specified value and notifies subscribers regardless of whether the value has changed.
-
subscribe
public ObservableValue<T> subscribe(ObservableValue.Subscriber<T> fn)
-
publish
public void publish()
-
-