Class SimpleObservableFloatProperty
java.lang.Object
dev.prozilla.pine.common.property.mutable.SimpleMutableFloatProperty
dev.prozilla.pine.common.property.observable.SimpleObservableFloatProperty
- All Implemented Interfaces:
Destructible,FloatProperty,MutableFloatProperty,MutableProperty<Float>,NonNullProperty<Float>,ObservableFloatProperty,ObservableProperty<Float>,SimpleObservableProperty<Float>,Property<Float>,Functor<Float>
- Direct Known Subclasses:
DeserializedFloatProperty,FloatConfigOption
public class SimpleObservableFloatProperty
extends SimpleMutableFloatProperty
implements ObservableFloatProperty, SimpleObservableProperty<Float>
-
Field Summary
FieldsFields inherited from interface dev.prozilla.pine.common.property.observable.ObservableProperty
OBSERVER_ERROR -
Constructor Summary
ConstructorsConstructorDescriptionSimpleObservableFloatProperty(float initialValue) Creates an observable property with an initial value. -
Method Summary
Modifier and TypeMethodDescriptionaddObserver(FloatObserver observer) voiddestroy()Removes all observers.protected Loggerprotected voidonValueChange(float oldValue, float newValue) Triggers all observers with the newValue whenever the value changes.voidremoveObserver(FloatObserver 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.SimpleMutableFloatProperty
get, setMethods 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.FloatProperty
get, getValue, getValueOr, has, hasProperty, isZeroProperty, map, replaceNull, requireValueMethods inherited from interface dev.prozilla.pine.common.property.mutable.MutableFloatProperty
modify, set, setValue, swap, viewPropertyMethods inherited from interface dev.prozilla.pine.common.property.mutable.MutableProperty
modifyValue, swapValueMethods inherited from interface dev.prozilla.pine.common.property.NonNullProperty
isNotNull, isNotNullPropertyMethods inherited from interface dev.prozilla.pine.common.property.observable.ObservableFloatProperty
addObserver, read, read, removeObserverMethods inherited from interface dev.prozilla.pine.common.property.Property
hasValue, hasValueProperty, isNull, map, snapshot, toStringProperty
-
Field Details
-
logger
-
-
Constructor Details
-
SimpleObservableFloatProperty
public SimpleObservableFloatProperty(float initialValue) Creates an observable property with an initial value.- Parameters:
initialValue- The initial value
-
-
Method Details
-
addObserver
- Specified by:
addObserverin interfaceObservableFloatProperty
-
removeObserver
- Specified by:
removeObserverin interfaceObservableFloatProperty
-
setLogger
Description copied from interface:SimpleObservablePropertySets the logger of this property, which is used to log errors thrown by observers.- Specified by:
setLoggerin interfaceSimpleObservableProperty<Float>
-
onValueChange
protected void onValueChange(float oldValue, float newValue) Triggers all observers with the newValue whenever the value changes.- Overrides:
onValueChangein classSimpleMutableFloatProperty- Parameters:
oldValue- The previous valuenewValue- The new value
-
getLogger
-
destroy
public void destroy()Removes all observers.- Specified by:
destroyin interfaceDestructible
-