Class RegionState<S,E>
java.lang.Object
org.springframework.statemachine.support.LifecycleObjectSupport
org.springframework.statemachine.state.AbstractState<S,E>
org.springframework.statemachine.state.RegionState<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 states are wrapped in a regions..- Author:
- Janne Valkealahti
-
Field Summary
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorDescriptionRegionState
(S id, Collection<Region<S, E>> regions) Instantiates a new region state.RegionState
(S id, Collection<Region<S, E>> regions, Collection<E> deferred) Instantiates a new region state.RegionState
(S id, Collection<Region<S, E>> regions, 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 region state.RegionState
(S id, Collection<Region<S, E>> regions, 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 region state.RegionState
(S id, Collection<Region<S, E>> regions, PseudoState<S, E> pseudoState) Instantiates a new region 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.void
setRegionExecutionPolicy
(RegionExecutionPolicy regionExecutionPolicy) Sets the region execution policy.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
-
RegionState
Instantiates a new region state.- Parameters:
id
- the state identifierregions
- the regions
-
RegionState
Instantiates a new region state.- Parameters:
id
- the state identifierregions
- the regionsdeferred
- the deferred
-
RegionState
Instantiates a new region state.- Parameters:
id
- the state identifierregions
- the regionspseudoState
- the pseudo state
-
RegionState
public RegionState(S id, Collection<Region<S, E>> regions, 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 region state.- Parameters:
id
- the state identifierregions
- the regionsdeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actionspseudoState
- the pseudo state
-
RegionState
public RegionState(S id, Collection<Region<S, E>> regions, 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 region state.- Parameters:
id
- the state identifierregions
- the regionsdeferred
- the deferredentryActions
- the entry actionsexitActions
- the exit actions
-
-
Method Details
-
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
-
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. -
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. -
setRegionExecutionPolicy
Sets the region execution policy.- Parameters:
regionExecutionPolicy
- the new region execution policy
-
toString
- Overrides:
toString
in classAbstractState<S,
E>
-