Class StateMachineState<S,E>
java.lang.Object
org.springframework.statemachine.support.LifecycleObjectSupport
org.springframework.statemachine.state.AbstractState<S,E>
org.springframework.statemachine.state.StateMachineState<S,E>
- Type Parameters:
S
- the type of stateE
- the type of event
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.Lifecycle
,org.springframework.context.Phased
,org.springframework.context.SmartLifecycle
,State<S,
,E> StateMachineReactiveLifecycle
A
State
implementation where state is wrapped in a substatemachine.-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorDescriptionStateMachineState
(S id, StateMachine<S, E> submachine) Instantiates a new state machine state.StateMachineState
(S id, StateMachine<S, E> submachine, Collection<E> deferred) Instantiates a new state machine state.StateMachineState
(S id, StateMachine<S, E> submachine, Collection<E> deferred, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> entryActions, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> exitActions) Instantiates a new state machine state.StateMachineState
(S id, StateMachine<S, E> submachine, Collection<E> deferred, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> entryActions, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> exitActions, PseudoState<S, E> pseudoState) Instantiates a new state machine state.StateMachineState
(S id, StateMachine<S, E> submachine, PseudoState<S, E> pseudoState) Instantiates a new state machine state. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
entry
(StateContext<S, E> context) Initiate an entry sequence for the state.reactor.core.publisher.Mono<Void>
exit
(StateContext<S, E> context) Initiate an exit sequence for the state.getIds()
Gets the state identifiers.Collection<State<S,
E>> Gets all possible states this state knows about including itself and substates.reactor.core.publisher.Flux<StateMachineEventResult<S,
E>> Send an eventE
wrapped with aMessage
to the state and return aStateMachineEventResult
for results.boolean
shouldDefer
(org.springframework.messaging.Message<E> event) Checks if state wants to defer an event.toString()
Methods inherited from class org.springframework.statemachine.state.AbstractState
addActionListener, addStateListener, armTriggers, disarmTriggers, doPreStartReactively, doPreStopReactively, executeAction, getDeferredEvents, getEntryActions, getExitActions, getId, getPseudoState, getRegions, getStateActions, getSubmachine, getTriggers, handleStateDoOnComplete, isComposite, isOrthogonal, isSimple, isSubmachineState, notifyStateOnComplete, removeActionListener, removeStateListener, setStateDoActionPolicy, setStateDoActionPolicyTimeout, setTriggers
Methods inherited from class org.springframework.statemachine.support.LifecycleObjectSupport
afterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactively
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.context.SmartLifecycle
stop
-
Constructor Details
-
StateMachineState
Instantiates a new state machine state.- Parameters:
id
- the state identifiersubmachine
- the submachine
-
StateMachineState
Instantiates a new state machine state.- Parameters:
id
- the state identifiersubmachine
- the submachinedeferred
- the deferred
-
StateMachineState
Instantiates a new state machine state.- Parameters:
id
- the state identifiersubmachine
- the submachinepseudoState
- the pseudo state
-
StateMachineState
public StateMachineState(S id, StateMachine<S, E> submachine, Collection<E> deferred, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> entryActions, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> exitActions, PseudoState<S, E> pseudoState) Instantiates a new state machine state.- Parameters:
id
- the state identifiersubmachine
- the submachinedeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actionspseudoState
- the pseudo state
-
StateMachineState
public StateMachineState(S id, StateMachine<S, E> submachine, Collection<E> deferred, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> entryActions, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> exitActions) Instantiates a new state machine state.- Parameters:
id
- the state identifiersubmachine
- the submachinedeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actions
-
-
Method Details
-
getIds
Description copied from interface:State
Gets the state identifiers. Usually returned collection contains only one identifier except in a case where state is an orthogonal. -
getStates
Description copied from interface:State
Gets all possible states this state knows about including itself and substates. -
exit
Description copied from interface:State
Initiate an exit sequence for the state. -
entry
Description copied from interface:State
Initiate an entry sequence for the state. -
sendEvent
public reactor.core.publisher.Flux<StateMachineEventResult<S,E>> sendEvent(org.springframework.messaging.Message<E> event) Description copied from interface:State
Send an eventE
wrapped with aMessage
to the state and return aStateMachineEventResult
for results. -
shouldDefer
Description copied from interface:State
Checks if state wants to defer an event.- Specified by:
shouldDefer
in interfaceState<S,
E> - Overrides:
shouldDefer
in classAbstractState<S,
E> - Parameters:
event
- the wrapped event- Returns:
- true if event should be deferred
-
toString
- Overrides:
toString
in classAbstractState<S,
E>
-