Interface ObservableView<T>
- Type Parameters:
T- the contained value type
- All Superinterfaces:
Supplier<T>
- All Known Implementing Classes:
ObservableProperty
A read-only observable property.
- Since:
- 4.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA listener for changes in observable views and properties. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(ObservableView.ChangeListener<? super T> listener) Adds a change listener to this property view.find()Returns the nonnull value of this property, orOptional.empty()if null or not initialized.get()Returns the value of this property.default TReturns the value of this property, or null if not initialized.booleanhasValue()Returns whether this property has been set to a value.voidremoveListener(ObservableView.ChangeListener<? super T> listener) Removes a change listener from this property view if present.
-
Method Details
-
hasValue
boolean hasValue()Returns whether this property has been set to a value.- Returns:
- whether this property has been set to a value
-
get
T get()Returns the value of this property.- Specified by:
getin interfaceSupplier<T>- Returns:
- the value of this property
- Throws:
IllegalStateException- if not initialized- See Also:
-
getOrNull
Returns the value of this property, or null if not initialized.- Returns:
- the value of this property, or null if not initialized
-
find
Returns the nonnull value of this property, orOptional.empty()if null or not initialized.- Returns:
- the nonnull value of this property, or
Optional.empty()if null or not initialized
-
addListener
Adds a change listener to this property view.- Parameters:
listener- the added listener
-
removeListener
Removes a change listener from this property view if present.- Parameters:
listener- the removed listener
-