Transitioner

abstract class Transitioner<ID, T : Transition<ID, V, S>, V : Value<ID, V, S>, S : State<ID, V, S>>

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun persist(from: S, value: V, via: T): Result<V>

Will be executed after the transition effect. Use this to persist the value.

Link copied to clipboard
open fun postHook(from: S, value: V, via: T): Result<Unit>

Will be executed after the transition effect & value persistence. Use this to perform side effects such as notifications.

Link copied to clipboard
open fun preHook(value: V, via: T): Result<Unit>

Will be executed prior to the transition effect. Failure here will terminate the transition

Link copied to clipboard
fun transition(value: V, transition: T): Result<V>

Execute the given transition on the given value.