Class MutableProperty<T>

java.lang.Object
dev.prozilla.pine.common.property.VariableProperty<T>
dev.prozilla.pine.common.property.MutableProperty<T>
Direct Known Subclasses:
ObservableProperty

public class MutableProperty<T> extends VariableProperty<T>
A property whose value can be changed using a setter.
  • Constructor Details

    • MutableProperty

      public MutableProperty()
      Creates a mutable property without an initial value.
    • MutableProperty

      public MutableProperty(T initialValue)
      Creates a mutable property with an initial value.
      Parameters:
      initialValue - The initial value
  • Method Details

    • setValue

      public boolean setValue(T value)
      Sets the value of this property.
      Parameters:
      value - The new value
      Returns:
      true if the value was changed.
    • onValueChange

      protected void onValueChange(T oldValue, T newValue)
      This method is called whenever the value of this property changes.

      The default implementation does nothing.

      Parameters:
      oldValue - The previous value
      newValue - The new value
    • getValue

      public T getValue()
      Specified by:
      getValue in class VariableProperty<T>
      Returns:
      The value of this property.
    • exists

      public boolean exists()
      Returns:
      true if the value is not null.