Interface LoadedValue<T>

Type Parameters:
T - value type

@PublicApi public interface LoadedValue<T>

Represents a value loaded from the attribute system. Contains the AttributeValue and a boolean outdated flag.

Note that the object is immutable with regards to the attribute value only. Outdated flag may change from false to true once during the lifespan of a loaded value.

See Also:
  • Method Details

    • getValue

      @NotNull AttributeValue<T> getValue()
      Returns the loaded attribute value.
      Returns:
      attribute value
    • isOutdated

      boolean isOutdated()

      Returns true if this value has been outdated. An outdated value will be recalculated next time it is requested.

      A value may be outdated right away, or it may become outdated later.

      Returns:
      true if the value is outdated
    • of

      static <T> LoadedValue<T> of(@NotNull AttributeValue<T> attributeValue)
      Creates an instance of LoadedValue based on attribute value. This loaded value will never be outdated.
      Type Parameters:
      T - value type
      Parameters:
      attributeValue - attribute value
      Returns:
      loaded value
    • of

      static <T> LoadedValue<T> of(@Nullable T value)
      Creates an instance of LoadedValue based on a value itself. This loaded value will never be outdated.
      Type Parameters:
      T - value type
      Parameters:
      value - value
      Returns:
      loaded value