State Handler Holder
class StateHandlerHolder<I : State>(inputKlass: KClass<I>, strict: Boolean, delegateTo: StatesHandler<I>) : StatesHandler<State>
Content copied to clipboard
Default realization of StatesHandler. It will incapsulate checking of State type in checkHandleable and class casting in handleState
Constructors
StateHandlerHolder
Link copied to clipboard
fun <I : State> StateHandlerHolder(inputKlass: KClass<I>, strict: Boolean = false, delegateTo: StatesHandler<I>)
Content copied to clipboard
Functions
check Handleable
Link copied to clipboard
Checks that state can be handled by delegateTo. Under the hood it will check exact equality of state and use KClass.isInstance of inputKlass if strict == false
handle State
Link copied to clipboard
open suspend override fun StatesMachine.handleState(state: State): State?
Content copied to clipboard
Calls delegateTo method StatesHandler.handleState with state casted to I. Use checkHandleable to be sure that this StateHandlerHolder will be able to handle state