-
- 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 belinked
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
orRef
) for retaining state across code changes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Linkable.Double
A double primitive specialisation of Linkable.static interface
Linkable.Int
An int primitive specialisation of Linkable.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods 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 Detail
-
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:
-
-