EventTransitionBuilder

class EventTransitionBuilder<S, E : StateEvent, T : E>(scope: StateConversationalScope<S, E>, eventClass: KClass<T>)

Builder for event transitions with conversational syntax. Not an inner class to avoid type parameter shadowing.

Constructors

Link copied to clipboard
constructor(scope: StateConversationalScope<S, E>, eventClass: KClass<T>)

Properties

Link copied to clipboard

Indicates the state should remain unchanged.

Functions

Link copied to clipboard
infix fun becomes(newState: S): TransitionWithSideEffect<S, E>

Specifies the target state for the transition.

Link copied to clipboard
infix fun becomesFrom(transition: (S) -> S): TransitionWithSideEffect<S, E>

Specifies a dynamic transition based on current state.

Link copied to clipboard
infix fun becomesUsing(transition: (S, E) -> S): TransitionWithSideEffect<S, E>

Specifies a dynamic transition using both state and event.

Link copied to clipboard
infix fun given(condition: (S) -> Boolean): EventTransitionBuilder<S, E, T>

Adds a guard condition to the transition.

Link copied to clipboard
fun givenWith(condition: (S, E) -> Boolean): EventTransitionBuilder<S, E, T>

Adds a guard condition that uses both state and event.