Documentation / dataflow-async / com.femastudios.dataflow.async / Attribute / transform
Go to reference

transform

open fun <O> transform(transform: WorkContext.(T) -> O): RecomputableAttribute<O>

Returns a new Attribute<O> whose Loaded value is transformed applying the given transform function. If the current state is Loaded or Error, it will be reflected on the transformed attribute.

The transform function has a WorkContext receiver that allows to set a state other than Loaded on the new Attribute if necessary.

The default flow strategy FlowStrategy.EVENTUALLY_CONSISTENT is used.

See Also

FlowStrategy

WorkContext


open fun <O> transform(flowStrategy: FlowStrategy, transform: WorkContext.(T) -> O): RecomputableAttribute<O>

Returns a new Attribute<O> whose Loaded value is transformed applying the given transform function. If the current state is Loaded or Error, it will be reflected on the transformed attribute.

The transform function has a WorkContext receiver that allows to set a state other than Loaded on the new Attribute if necessary.

The flowStrategy parameter controls where the computation is run and how the Attribute will behave on subsequent computations.

See Also

FlowStrategy

WorkContext