Interface FixedProperty<T>

All Superinterfaces:
Functor<T>, Property<T>
All Known Implementing Classes:
FixedBooleanProperty, FixedColorProperty, FixedFloatProperty, FixedIntProperty, FixedObjectProperty, FixedStringProperty, NullProperty
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface FixedProperty<T> extends Property<T>
A property with a value that never changes.
  • Method Details

    • toStringProperty

      default FixedStringProperty toStringProperty()
      Description copied from interface: Property
      Returns a string property whose value is the string representation of the value of this property.

      If the value of this property is null, the value of the string property with also be null.

      Specified by:
      toStringProperty in interface Property<T>
      Returns:
      A string property based on the value of this property.
    • isNotNullProperty

      default FixedBooleanProperty isNotNullProperty()
      Description copied from interface: Property
      Returns a boolean property whose value is true if the value of this property is not null and vice versa.
      Specified by:
      isNotNullProperty in interface Property<T>
      Returns:
      A boolean property whose value is true if the value of this property is not null and vice versa.
      See Also:
    • hasValueProperty

      default FixedBooleanProperty hasValueProperty(T value)
      Description copied from interface: Property
      Returns a boolean property whose value is true if the value of this property is equal to value.
      Specified by:
      hasValueProperty in interface Property<T>
      Returns:
      A boolean property whose value is true if the value of this property is equal to value.
      See Also:
    • snapshot

      @Contract("-> this") default FixedProperty<T> snapshot()
      Returns this property, because its value is always the same, so it is effectively the same as a snapshot.
      Specified by:
      snapshot in interface Property<T>
      Returns:
      This property.
    • replaceNull

      default FixedProperty<T> replaceNull(T defaultValue)
      Description copied from interface: Property
      Returns a property whose value is the value of this property, or defaultValue if the value of this property is null.
      Specified by:
      replaceNull in interface Property<T>
      Returns:
      A property whose value is never null.
    • map

      default <S> FixedProperty<S> map(Mapper<T,S> mapper)
      Description copied from interface: Functor
      Applies a function to the value of this functor.
      Specified by:
      map in interface Functor<T>
      Specified by:
      map in interface Property<T>
      Type Parameters:
      S - The output type of the mapper
      Parameters:
      mapper - The function to apply
      Returns:
      The functor containing the mapped value
    • fromValue

      static <T> FixedProperty<T> fromValue(T value)
      Creates a new fixed property based on a given value.
      Type Parameters:
      T - The type of value
      Parameters:
      value - A value or null
      Returns:
      A FixedObjectProperty if value is not null, otherwise a NullProperty.