# CustomizableHandlerHolder

class CustomizableHandlerHolder < I : O , O : State >(delegateTo: StatesHandler < I , O >, filter: suspend (state: O ) -> Boolean ) : CheckableHandlerHolder < I , O > (source)

Default realization of StatesHandler. It will incapsulate checking of State type in checkHandleable and class casting in handleState

## Constructors

CustomizableHandlerHolder
Link copied to clipboard
constructor(delegateTo: StatesHandler < I , O >, filter: suspend (state: O ) -> Boolean )

## Functions

checkHandleable
Link copied to clipboard
open suspend override fun checkHandleable (state: O ): Boolean

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

handleState
Link copied to clipboard
open suspend override fun StatesMachine <in O >. handleState (state: I ): O ?

Calls delegateTo method StatesHandler.handleState with state casted to I. Use checkHandleable to be sure that this StatesHandlerHolder will be able to handle state

holder
Link copied to clipboard
inline fun < I : O , O : State > StatesHandler < I , O >. holder (strict: Boolean = true): CustomizableHandlerHolder < O , O >
inline fun < I : O , O : State > StatesHandler < I , O >. holder (noinline filter: suspend (state: State ) -> Boolean ): CustomizableHandlerHolder < O , O >