Class StoredProperty<T>

java.lang.Object
dev.prozilla.pine.common.property.storage.StoredProperty<T>
All Implemented Interfaces:
Destructible, MutableObjectProperty<T>, MutableProperty<T>, Property<T>, Functor<T>
Direct Known Subclasses:
StoredBooleanProperty, StoredFloatProperty, StoredIntProperty, StoredStringProperty

public abstract class StoredProperty<T> extends Object implements MutableObjectProperty<T>, Destructible
  • Field Details

    • storage

      protected final Storage storage
    • key

      protected final String key
  • Constructor Details

    • StoredProperty

      public StoredProperty(Storage storage, String key)
  • Method Details

    • getValue

      public abstract T getValue()
      Description copied from interface: Property
      Returns the value of this property.
      Specified by:
      getValue in interface Property<T>
      Returns:
      The value of this property.
    • isNotNull

      public boolean isNotNull()
      Description copied from interface: Property
      Checks if the value of this property is not null.
      Specified by:
      isNotNull in interface Property<T>
      Returns:
      true if the value of this property is not null.
    • setNull

      public boolean setNull()
      Description copied from interface: MutableObjectProperty
      Sets the value of this property to null.
      Specified by:
      setNull in interface MutableObjectProperty<T>
      Returns:
      false if the value of this property was already null.
    • setValue

      public boolean setValue(String value)
    • setValue

      public boolean setValue(T value)
      Description copied from interface: MutableProperty
      Sets the value of this property.
      Specified by:
      setValue in interface MutableProperty<T>
      Parameters:
      value - The new value
      Returns:
      true if the value was changed.
    • destroy

      public void destroy()
      Removes the corresponding item from the store.
      Specified by:
      destroy in interface Destructible
    • toStringProperty

      public StoredStringProperty toStringProperty()
      Returns a stored string property with the same key as this property.
      Specified by:
      toStringProperty in interface Property<T>
      Returns:
      A new stored string property.
      See Also: