Class SimpleObservableObjectProperty<T>
java.lang.Object
dev.prozilla.pine.common.property.mutable.SimpleMutableObjectProperty<T>
dev.prozilla.pine.common.property.observable.SimpleObservableObjectProperty<T>
- All Implemented Interfaces:
Destructible,MutableObjectProperty<T>,MutableProperty<T>,ObservableObjectProperty<T>,ObservableProperty<T>,SimpleObservableProperty<T>,Property<T>,Functor<T>
- Direct Known Subclasses:
DeserializedObjectProperty,FileDeserializer,ObjectConfigOption,SelectionProperty,SimpleObservableStringProperty
public class SimpleObservableObjectProperty<T>
extends SimpleMutableObjectProperty<T>
implements ObservableObjectProperty<T>, SimpleObservableProperty<T>
-
Field Summary
FieldsFields inherited from interface dev.prozilla.pine.common.property.observable.ObservableProperty
OBSERVER_ERROR -
Constructor Summary
ConstructorsConstructorDescriptionCreates an observable property without an initial value.SimpleObservableObjectProperty(T initialValue) Creates an observable property with an initial value. -
Method Summary
Modifier and TypeMethodDescriptionaddObserver(Observer<T> observer) voiddestroy()Removes all observers.protected Loggerprotected voidonValueChange(T oldValue, T newValue) Triggers all observers with the newValue whenever the value changes.voidremoveObserver(Observer<T> observer) voidSets the logger of this property, which is used to log errors thrown by observers.Methods inherited from class dev.prozilla.pine.common.property.mutable.SimpleMutableObjectProperty
getValue, setValueMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.prozilla.pine.common.property.mutable.MutableObjectProperty
setNull, stealMethods inherited from interface dev.prozilla.pine.common.property.mutable.MutableProperty
modifyValue, setValue, swapValue, viewPropertyMethods inherited from interface dev.prozilla.pine.common.property.observable.ObservableProperty
readMethods inherited from interface dev.prozilla.pine.common.property.Property
getValue, getValueOr, hasValue, hasValueProperty, isNotNull, isNotNullProperty, isNull, map, replaceNull, requireValue, snapshot, toStringProperty
-
Field Details
-
logger
-
-
Constructor Details
-
SimpleObservableObjectProperty
public SimpleObservableObjectProperty()Creates an observable property without an initial value. -
SimpleObservableObjectProperty
Creates an observable property with an initial value.- Parameters:
initialValue- The initial value
-
-
Method Details
-
addObserver
- Specified by:
addObserverin interfaceObservableProperty<T>
-
removeObserver
- Specified by:
removeObserverin interfaceObservableProperty<T>
-
setLogger
Description copied from interface:SimpleObservablePropertySets the logger of this property, which is used to log errors thrown by observers.- Specified by:
setLoggerin interfaceSimpleObservableProperty<T>
-
onValueChange
Triggers all observers with the newValue whenever the value changes.- Overrides:
onValueChangein classSimpleMutableObjectProperty<T>- Parameters:
oldValue- The previous valuenewValue- The new value
-
getLogger
-
destroy
public void destroy()Removes all observers.- Specified by:
destroyin interfaceDestructible
-