async State Machine
inline fun <S, E, C : Any, A : Any, R : Any> asyncStateMachine(validStates: Set<S>, validEvents: Set<E>, contextClass: KClass<out C>, argumentClass: KClass<out A>, returnClass: KClass<out R>, handler: AsyncDslStateMachineHandler<S, E, C, A, R>.() -> Unit): AsyncDslStateMachineHandler<S, E, C, A, R>
These function are used to create statemachines where the actions are suspend functions.
inline fun <S, E, C : Any, A : Any> asyncStateMachine(validStates: Set<S>, validEvents: Set<E>, contextClass: KClass<out C>, argumentClass: KClass<out A>, handler: AsyncDslStateMachineHandler<S, E, C, A, Any>.() -> Unit): AsyncDslStateMachineHandler<S, E, C, A, Any>
Defines the start of a state machine DSL declaration with Any
as the return type
Parameters
valid States
A set of the possible states supported by the top-level state map
valid Events
The class of the possible events*
context Class
The class of the context
argument Class
The class of the argument to events/actions
handler
The state machine handler
Samples
io.jumpco.open.kfsm.TurnstileFSM.definitioninline fun <S, E, C : Any> asyncStateMachine(validStates: Set<S>, validEvents: Set<E>, contextClass: KClass<out C>, handler: AsyncDslStateMachineHandler<S, E, C, Any, Any>.() -> Unit): AsyncDslStateMachineHandler<S, E, C, Any, Any>
Defines the start of a state machine DSL declaration with Any
as the type of arguments and returns types for events/actions
Parameters
valid States
A set of the possible states supported by the top-level state map
valid Events
The class of the possible events
context Class
The class of the context