All Known Implementing Classes:
SimpleLifecycled

public interface Lifecycled<T>
  • Method Details

    • value

      Optional<T> value()
      Get the value or Optional.empty().
      Returns:
      the value
    • valueOrThrow

      default T valueOrThrow() throws IllegalStateException
      Get the value or throw.
      Returns:
      the value
      Throws:
      IllegalStateException - if there is no value
    • isValid

      default boolean isValid()
      Check for validity, usually without triggering computation.
      Returns:
      if this lifecycled's value() is valid
    • events

      Lifecycled.Events<T> events()
      Get the event manager for this lifecycled object.
      Returns:
      the event manager
    • map

      default <U> Lifecycled<U> map(Function<T,U> mapper)
      Map the value.
      Type Parameters:
      U - the new type
      Parameters:
      mapper - the mapper function
      Returns:
      the downstream lifecycled
    • filter

      default Lifecycled<T> filter(Predicate<T> filterer)
      Filter the value. In other words, create a new lifecycled object where validity is ANDed with the result of calling the filter function.
      Parameters:
      filterer - the filter function
      Returns:
      the downstream lifecycled
    • flatMap

      default <U> Lifecycled<U> flatMap(Function<T,Lifecycled<U>> mapper)