Interface Linkable<T>

Type Parameters:
T -

public interface Linkable<T>
Linkable is a lightweight form of reactive stream for listening to changing values from inputs, properties, animation, etc. Functions can be used to filter and map incoming values. Linkables must be linked to a Consumer to complete the pipeline or no values will be processed.

Only stateless operations are currently supported. Operations that require access to previous values (limit, sort, distinct, etc.) require combining with one of the other mechanisms (eg. Inject or Ref) for retaining state across code changes.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A double primitive specialisation of Linkable.
    static interface 
    An int primitive specialisation of Linkable.
  • Method Summary

    Modifier and Type
    Method
    Description
    default Linkable<T>
    filter(Predicate<? super T> predicate)
    Returns a Linkable that wraps this Linkable and filters values using the provided predicate function.
    void
    link(Consumer<T> consumer)
    Link to a Consumer to process values.
    default <R> Linkable<R>
    map(Function<? super T,? extends R> function)
    Returns a Linkable that wraps this Linkable and transforms values using the provided mapping function.
  • Method Details

    • link

      void link(Consumer<T> consumer)
      Link to a Consumer to process values. Setting a Consumer completes the pipeline. Only one Consumer may be set on a Linkable pipeline - to use multiple consumers, acquire a new Linkable from the original source.
      Parameters:
      consumer - function to process received values.
    • map

      default <R> Linkable<R> map(Function<? super T,? extends R> function)
      Returns a Linkable that wraps this Linkable and transforms values using the provided mapping function.
      Type Parameters:
      R -
      Parameters:
      function - transform values
      Returns:
    • filter

      default Linkable<T> filter(Predicate<? super T> predicate)
      Returns a Linkable that wraps this Linkable and filters values using the provided predicate function.
      Parameters:
      predicate -
      Returns: