Class MutableProperty<T>
java.lang.Object
dev.prozilla.pine.common.property.VariableProperty<T>
dev.prozilla.pine.common.property.MutableProperty<T>
- Direct Known Subclasses:
ObservableProperty
A property whose value can be changed using a setter.
-
Field Summary
Fields inherited from class dev.prozilla.pine.common.property.VariableProperty
random
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a mutable property without an initial value.MutableProperty
(T initialValue) Creates a mutable property with an initial value. -
Method Summary
-
Constructor Details
-
MutableProperty
public MutableProperty()Creates a mutable property without an initial value. -
MutableProperty
Creates a mutable property with an initial value.- Parameters:
initialValue
- The initial value
-
-
Method Details
-
setValue
Sets the value of this property.- Parameters:
value
- The new value- Returns:
true
if the value was changed.
-
onValueChange
This method is called whenever the value of this property changes.The default implementation does nothing.
- Parameters:
oldValue
- The previous valuenewValue
- The new value
-
getValue
- Specified by:
getValue
in classVariableProperty<T>
- Returns:
- The value of this property.
-
exists
public boolean exists()- Returns:
true
if the value is not null.
-