Package io.hektor.fsm.builder
Interface TransitionBuilder<E,S extends Enum<S>,C extends Context,D extends Data>
- All Known Implementing Classes:
TransitionBuilderImpl
-
Method Summary
Modifier and TypeMethodDescriptionTransition<E,S, C, D> build()default TransitionBuilder<E,S, C, D> consume()default TransitionBuilder<E,S, C, D> withAction(Action<E, C, D> action) default TransitionBuilder<E,S, C, D> withAction(Consumer<E> action) withAction(Consumer<E> action, Label label) default TransitionBuilder<E,S, C, D> default TransitionBuilder<E,S, C, D> default <R> TransitionBuilder<E,S, C, D> withTransformation(Function<E, R> transformation) <R> TransitionBuilder<E,S, C, D> withTransformation(Function<E, R> transformation, Label label) For transitions to a transient state, you can optionally specify a transformation that will be applied to the original event before entering the state you're automatically transitioning to.
-
Method Details
-
withGuard
- Parameters:
guard-- Returns:
- Throws:
IllegalStateException- in case you are trying to specify a guard for a transition that has been marked as a default transition (by definition, that "guard" is then accepting all)
-
withGuard
- Throws:
IllegalStateException
-
withGuard
- Parameters:
guard-- Returns:
- Throws:
IllegalStateException- in case you are trying to specify a guard for a transition that has been marked as a default transition (by definition, that "guard" is then accepting all)
-
withGuard
- Throws:
IllegalStateException
-
consume
-
withAction
-
withAction
-
withAction
-
withAction
-
withTransformation
<R> TransitionBuilder<E,S, withTransformationC, D> (Function<E, R> transformation, Label label) throws IllegalStateExceptionFor transitions to a transient state, you can optionally specify a transformation that will be applied to the original event before entering the state you're automatically transitioning to. NOTE: the validation that the target state is indeed a transient state cannot be performed until the actual state machine definition is built (FSMBuilder.build()) so if you specify a transformation on aTransitionthat go to a "regular" state, then it will not be detected until later at which time anFSMBuilderExceptionwill be thrown.- Type Parameters:
R-- Parameters:
transformation-- Returns:
- Throws:
IllegalStateException- in case a transformation has already been specified.
-
withTransformation
default <R> TransitionBuilder<E,S, withTransformationC, D> (Function<E, R> transformation) throws IllegalStateException- Throws:
IllegalStateException
-
build
Transition<E,S, build()C, D>
-