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
ConstructorsConstructorDescriptionRegionState(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 eventEwrapped with aMessageto the state and return aStateMachineEventResultfor results.voidsetRegionExecutionPolicy(RegionExecutionPolicy regionExecutionPolicy) Sets the region execution policy.booleanshouldDefer(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, setTriggersMethods inherited from class org.springframework.statemachine.support.LifecycleObjectSupport
afterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactivelyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:StateSend an eventEwrapped with aMessageto the state and return aStateMachineEventResultfor results. -
shouldDefer
Description copied from interface:StateChecks if state wants to defer an event.- Specified by:
shouldDeferin interfaceState<S,E> - Overrides:
shouldDeferin classAbstractState<S,E> - Parameters:
event- the wrapped event- Returns:
- true if event should be deferred
-
exit
Description copied from interface:StateInitiate an exit sequence for the state. -
entry
Description copied from interface:StateInitiate an entry sequence for the state. -
getIds
Description copied from interface:StateGets the state identifiers. Usually returned collection contains only one identifier except in a case where state is an orthogonal. -
getStates
Description copied from interface:StateGets 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:
toStringin classAbstractState<S,E>
-