Interface Property<T>

Type Parameters:
T - The type of property
All Superinterfaces:
Functor<T>
All Known Subinterfaces:
AnimatedPropertyBase<T>, BooleanProperty, ColorProperty, ConfigOption<T>, FixedProperty<T>, FloatProperty, IntProperty, MutableBooleanProperty, MutableFloatProperty, MutableIntProperty, MutableObjectProperty<T>, MutableProperty<T>, MutableStringProperty, NonNullProperty<T>, ObservableBooleanProperty, ObservableFloatProperty, ObservableIntProperty, ObservableObjectProperty<T>, ObservableProperty<T>, ObservableStringProperty, SimpleObservableProperty<T>, StringProperty, TransitionedProperty<T>, Vector2fProperty, Vector2fPropertyBase<T>, Vector3fProperty, Vector3fPropertyBase<T>, Vector4fProperty, Vector4fPropertyBase<T>
All Known Implementing Classes:
AdaptiveColorProperty, AdaptiveFloatProperty, AdaptiveIntProperty, AdaptiveObjectProperty, AdaptiveProperty, AdaptiveStringProperty, AnalogInputProperty, AnimatedColorProperty, AnimatedColorProperty.AnimatedAlpha, AnimatedDimensionProperty, AnimatedDualDimensionProperty, AnimatedFloatProperty, AnimatedIntProperty, AnimatedObjectProperty, AnimatedProperty, BooleanConfigOption, ConditionalProperty, DelegatedVector2fProperty, DelegatedVector2fPropertyBase, DelegatedVector3fProperty, DelegatedVector3fPropertyBase, DelegatedVector4fProperty, DelegatedVector4fPropertyBase, DeserializedBooleanProperty, DeserializedFloatProperty, DeserializedIntProperty, DeserializedObjectProperty, DeserializedStringProperty, FileDeserializer, FixedBooleanProperty, FixedColorProperty, FixedFloatProperty, FixedIntProperty, FixedObjectProperty, FixedStringProperty, FloatConfigOption, GamepadAxesProperty, GamepadAxisProperty, GamepadButtonProperty, GamepadButtonsProperty, HotFileDeserializer, IntConfigOption, JoinedStringProperty, KeyboardKeyProperty, KeyboardKeysProperty, LazyProperty, LocalRandomBooleanProperty, LocalRandomFloatProperty, LocalRandomIntProperty, LocalRandomObjectProperty, MouseButtonProperty, MouseButtonsProperty, NullProperty, ObjectConfigOption, ParsedProperty, RandomBooleanProperty, RandomFloatProperty, RandomIntProperty, RandomObjectProperty, RandomProperty, RandomVector2fProperty, RangedMutableIntProperty, SelectionProperty, SimpleMutableBooleanProperty, SimpleMutableFloatProperty, SimpleMutableIntProperty, SimpleMutableObjectProperty, SimpleMutableStringProperty, SimpleObservableBooleanProperty, SimpleObservableFloatProperty, SimpleObservableIntProperty, SimpleObservableObjectProperty, SimpleObservableStringProperty, SingleSelectionProperty, StoredBooleanProperty, StoredFloatProperty, StoredIntProperty, StoredProperty, StoredStringProperty, StringConfigOption, StyledColorProperty, StyledDimensionProperty, StyledDirectionProperty, StyledDistributionProperty, StyledDualDimensionProperty, StyledEdgeAlignmentProperty, StyledGridAlignmentProperty, StyledIntProperty, StyledObjectProperty, StyledProperty, SystemProperty, TransitionedColorProperty, TransitionedDimensionProperty, TransitionedDualDimensionProperty, TransitionedFloatProperty, TransitionedIntProperty, TransitionedObjectProperty, VariableAnimatedColorProperty, VariableAnimatedFloatProperty, VariableAnimatedProperty, VariableColorProperty
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 Property<T> extends Functor<T>
A property with a value that may change in certain circumstances.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of this property.
    static <T> T
    getValueOf(Property<T> property)
    Returns the value of a given property, or null if the property is null.
    static <T> T
    getValueOf(Property<T> property, T defaultValue)
    Returns the value of a given property, or a default value if the property or its value is null.
    default T
    getValueOr(T defaultValue)
    Returns the value of this property, or defaultValue if the value is null.
    default boolean
    hasValue(T value)
    Checks if this property has a given value.
    Returns a boolean property whose value is true if the value of this property is equal to value.
    default boolean
    Checks if the value of this property is not null.
    Returns a boolean property whose value is true if the value of this property is not null and vice versa.
    default boolean
    Checks if the value of this property is null.
    default <S> Property<S>
    map(Mapper<T,S> mapper)
    Applies a function to the value of this functor.
    default Property<T>
    replaceNull(T defaultValue)
    Returns a property whose value is the value of this property, or defaultValue if the value of this property is null.
    default T
    Returns the value of this property, if it is not null, otherwise throws an exception.
    default FixedProperty<T>
    Returns a fixed property whose value is the current value of this property, at the time of calling this method.
    Returns a string property whose value is the string representation of the value of this property.
  • Method Details

    • getValue

      T getValue()
      Returns the value of this property.
      Returns:
      The value of this property.
    • isNull

      default boolean isNull()
      Checks if the value of this property is null.
      Returns:
      true if the value of this property is null.
    • isNotNull

      default boolean isNotNull()
      Checks if the value of this property is not null.
      Returns:
      true if the value of this property is not null.
    • hasValue

      default boolean hasValue(T value)
      Checks if this property has a given value.
      Parameters:
      value - The value to check for
      Returns:
      true if the value of this property is equal to value.
    • getValueOr

      @Contract("null -> fail; !null -> !null") default T getValueOr(T defaultValue)
      Returns the value of this property, or defaultValue if the value is null.
      Parameters:
      defaultValue - The default value to use
      Returns:
      The value of this property, or defaultValue if the value is null.
    • requireValue

      @NotNull default T requireValue() throws InvalidObjectException
      Returns the value of this property, if it is not null, otherwise throws an exception.
      Returns:
      The value of this property
      Throws:
      InvalidObjectException - If the value of this property is null.
    • replaceNull

      @Contract("_ -> new") default Property<T> replaceNull(T defaultValue)
      Returns a property whose value is the value of this property, or defaultValue if the value of this property is null.
      Returns:
      A property whose value is never null.
    • map

      default <S> Property<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>
      Type Parameters:
      S - The output type of the mapper
      Parameters:
      mapper - The function to apply
      Returns:
      The functor containing the mapped value
    • toStringProperty

      @Contract("-> new") default StringProperty toStringProperty()
      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.

      Returns:
      A string property based on the value of this property.
    • isNotNullProperty

      default BooleanProperty isNotNullProperty()
      Returns a boolean property whose value is true if the value of this property is not null and vice versa.
      Returns:
      A boolean property whose value is true if the value of this property is not null and vice versa.
      See Also:
    • hasValueProperty

      default BooleanProperty hasValueProperty(T value)
      Returns a boolean property whose value is true if the value of this property is equal to value.
      Returns:
      A boolean property whose value is true if the value of this property is equal to value.
      See Also:
    • snapshot

      default FixedProperty<T> snapshot()
      Returns a fixed property whose value is the current value of this property, at the time of calling this method.
      Returns:
      A fixed property with the current value of this property.
    • getValueOf

      @Contract("null -> null") static <T> T getValueOf(Property<T> property)
      Returns the value of a given property, or null if the property is null.
      Type Parameters:
      T - The type of value
      Parameters:
      property - The property or null
      Returns:
      The value
    • getValueOf

      @Contract("null, _ -> param2") static <T> T getValueOf(Property<T> property, T defaultValue)
      Returns the value of a given property, or a default value if the property or its value is null.
      Type Parameters:
      T - The type of value
      Parameters:
      property - The property or null
      defaultValue - The value to use in case the property or its value is null.
      Returns:
      The value