- 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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceA double primitive specialisation of Linkable.static interfaceAn int primitive specialisation of Linkable. -
Method Summary
Modifier and TypeMethodDescriptionReturns a Linkable that wraps this Linkable and filters values using the provided predicate function.voidLink to a Consumer to process values.default <R> Linkable<R> Returns a Linkable that wraps this Linkable and transforms values using the provided mapping function.
-
Method Details
-
link
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
Returns a Linkable that wraps this Linkable and transforms values using the provided mapping function.- Type Parameters:
R-- Parameters:
function- transform values- Returns:
-
filter
Returns a Linkable that wraps this Linkable and filters values using the provided predicate function.- Parameters:
predicate-- Returns:
-