Dataflow async
Library ID dataflow-async
Latest version 1.0.5

First look

In this library we associate a state with the data. So a data can be loaded or not loaded, where the latter further decomposes in error and loading. The Attribute class is the equivalent of fields for this new paradigm.

Creating attributes


The functions to create attribute are similar to the ones that exist for creating fields.

attributeOf("hello") //Yields an Attribute<String> with the LOADED value of "hello" attributeOfNull() //Yields an Attribute<Nothing?> with the LOADED value of null //Yields an attribute with the LOADING status that, when queried (lazy=true), will begin computation asynchronously attributeOf(lazy = true) { //receiver is a WorkContext instance (more on this later) "super" + "expensive" + "computation" }

Transforming attributes


Transformations always computed asynchronously if not differently specified. The available extension functions are the same you find available for fields.


val attr = attributeOf(123); val pow2 = attr.transform { it * it }
Attribute<Integer> attr = Attribute.of(213); Attribute<Integer> pow2 = AttributeUtils.transform(attr, num -> num * num);