Class AbstractState<S,E> 
java.lang.Object
org.springframework.statemachine.support.LifecycleObjectSupport
org.springframework.statemachine.state.AbstractState<S,E> 
- Type Parameters:
- S- the type of state
- E- 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
- Direct Known Subclasses:
- AbstractSimpleState,- RegionState,- StateMachineState
Base implementation of a 
State.- 
Field SummaryFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractState(S id, Collection<E> deferred) Instantiates a new abstract state.AbstractState(S id, 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 abstract state.AbstractState(S id, 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, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> stateActions, PseudoState<S, E> pseudoState, Collection<Region<S, E>> regions, StateMachine<S, E> submachine) Instantiates a new abstract state.AbstractState(S id, 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 abstract state.AbstractState(S id, 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, Collection<Region<S, E>> regions) Instantiates a new abstract state.AbstractState(S id, 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, Collection<Region<S, E>> regions, StateMachine<S, E> submachine) Instantiates a new abstract state.AbstractState(S id, 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, StateMachine<S, E> submachine) Instantiates a new abstract state.AbstractState(S id, PseudoState<S, E> pseudoState) Instantiates a new abstract state.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddActionListener(ActionListener<S, E> listener) Adds the action listener.voidaddStateListener(StateListener<S, E> listener) Adds the state listener.protected voidArm triggers.protected voidDisarm triggers.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for pre start logic.protected reactor.core.publisher.Mono<Void>Subclasses may implement this for pre stop logic.reactor.core.publisher.Mono<Void>entry(StateContext<S, E> context) Initiate an entry sequence for the state.protected reactor.core.publisher.Mono<Void>executeAction(Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>> action, StateContext<S, E> context) Execute action and notify action listener if set.reactor.core.publisher.Mono<Void>exit(StateContext<S, E> context) Initiate an exit sequence for the state.Gets the deferred events for this state.Collection<Function<StateContext<S,E>, reactor.core.publisher.Mono<Void>>> GetsActions executed entering in this state.Collection<Function<StateContext<S,E>, reactor.core.publisher.Mono<Void>>> GetsActions executed exiting from this state.getId()Gets the state identifier.abstract Collection<S>getIds()Gets the state identifiers.Gets aPseudoStateattached to aState.Collection<Region<S,E>> Gets the regions.Collection<Function<StateContext<S,E>, reactor.core.publisher.Mono<Void>>> GetsActions executed once in this state.abstract Collection<State<S,E>> Gets all possible states this state knows about including itself and substates.Gets the submachine.Gets the triggers.protected reactor.core.publisher.Mono<Void>handleStateDoOnComplete(StateContext<S, E> context) booleanChecks if state is a composite state.booleanChecks if state is an orthogonal state.booleanisSimple()Checks if state is a simple state.booleanChecks if state is a submachine state.protected voidnotifyStateOnComplete(StateContext<S, E> context) voidremoveActionListener(ActionListener<S, E> listener) Removes the action listener.voidremoveStateListener(StateListener<S, E> listener) Removes the state listener.reactor.core.publisher.Flux<StateMachineEventResult<S,E>> Send an eventEwrapped with aMessageto the state and return aStateMachineEventResultfor results.voidsetStateDoActionPolicy(StateDoActionPolicy stateDoActionPolicy) voidsetStateDoActionPolicyTimeout(Long stateDoActionPolicyTimeout) voidsetTriggers(List<Trigger<S, E>> triggers) Sets the triggers.booleanshouldDefer(org.springframework.messaging.Message<E> event) Checks if state wants to defer an event.toString()Methods inherited from class org.springframework.statemachine.support.LifecycleObjectSupportafterPropertiesSet, destroy, doDestroy, doPostStartReactively, doPostStopReactively, getBeanFactory, getPhase, isAutoStartup, isRunning, onInit, setAutoStartup, setBeanFactory, setPhase, start, startReactively, stop, stopReactivelyMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecyclestop
- 
Constructor Details- 
AbstractStateInstantiates a new abstract state.- Parameters:
- id- the state identifier
- pseudoState- the pseudo state
 
- 
AbstractStateInstantiates a new abstract state.- Parameters:
- id- the state identifier
- deferred- the deferred
 
- 
AbstractStatepublic AbstractState(S id, 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 abstract state.- Parameters:
- id- the state identifier
- deferred- the deferred
- entryActions- the entry actions
- exitActions- the exit actions
 
- 
AbstractStatepublic AbstractState(S id, 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 abstract state.- Parameters:
- id- the state identifier
- deferred- the deferred
- entryActions- the entry actions
- exitActions- the exit actions
- pseudoState- the pseudo state
 
- 
AbstractStatepublic AbstractState(S id, 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, StateMachine<S, E> submachine) Instantiates a new abstract state.- Parameters:
- id- the state identifier
- deferred- the deferred
- entryActions- the entry actions
- exitActions- the exit actions
- pseudoState- the pseudo state
- submachine- the submachine
 
- 
AbstractStatepublic AbstractState(S id, 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, Collection<Region<S, E>> regions) Instantiates a new abstract state.- Parameters:
- id- the state identifier
- deferred- the deferred
- entryActions- the entry actions
- exitActions- the exit actions
- pseudoState- the pseudo state
- regions- the regions
 
- 
AbstractStatepublic AbstractState(S id, 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, Collection<Region<S, E>> regions, StateMachine<S, E> submachine) Instantiates a new abstract state.- Parameters:
- id- the state identifier
- deferred- the deferred
- entryActions- the entry actions
- exitActions- the exit actions
- pseudoState- the pseudo state
- regions- the regions
- submachine- the submachine
 
- 
AbstractStatepublic AbstractState(S id, 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, Collection<Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>>> stateActions, PseudoState<S, E> pseudoState, Collection<Region<S, E>> regions, StateMachine<S, E> submachine) Instantiates a new abstract state.- Parameters:
- id- the state identifier
- deferred- the deferred
- entryActions- the entry actions
- exitActions- the exit actions
- stateActions- the state actions
- pseudoState- the pseudo state
- regions- the regions
- submachine- the submachine
 
 
- 
- 
Method Details- 
sendEventpublic 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.
- 
shouldDeferDescription copied from interface:StateChecks if state wants to defer an event.- Specified by:
- shouldDeferin interface- State<S,- E> 
- Parameters:
- event- the wrapped event
- Returns:
- true if event should be deferred
 
- 
exitDescription copied from interface:StateInitiate an exit sequence for the state.
- 
entryDescription copied from interface:StateInitiate an entry sequence for the state.
- 
getIdDescription copied from interface:StateGets the state identifier.
- 
getIdsDescription copied from interface:StateGets the state identifiers. Usually returned collection contains only one identifier except in a case where state is an orthogonal.
- 
getStatesDescription copied from interface:StateGets all possible states this state knows about including itself and substates.
- 
getPseudoStateDescription copied from interface:StateGets aPseudoStateattached to aState.PseudoStateis not required and thus this method returnNULLif it's not set.- Specified by:
- getPseudoStatein interface- State<S,- E> 
- Returns:
- pseudostate or null if state doesn't have one
 
- 
getDeferredEventsDescription copied from interface:StateGets the deferred events for this state.- Specified by:
- getDeferredEventsin interface- State<S,- E> 
- Returns:
- the state deferred events
 
- 
getEntryActionsDescription copied from interface:StateGetsActions executed entering in this state.- Specified by:
- getEntryActionsin interface- State<S,- E> 
- Returns:
- the state entry actions
 
- 
getStateActionsDescription copied from interface:StateGetsActions executed once in this state.- Specified by:
- getStateActionsin interface- State<S,- E> 
- Returns:
- the state actions
 
- 
getExitActionsDescription copied from interface:StateGetsActions executed exiting from this state.- Specified by:
- getExitActionsin interface- State<S,- E> 
- Returns:
- the state exit actions
 
- 
isCompositepublic boolean isComposite()Description copied from interface:StateChecks if state is a composite state. A composite state is a state that contains at least one region.- Specified by:
- isCompositein interface- State<S,- E> 
- Returns:
- true, if state is a composite state
 
- 
isOrthogonalpublic boolean isOrthogonal()Description copied from interface:StateChecks if state is an orthogonal state. An orthogonal composite state contains two or more regions. If this method returnsTRUE,State.isComposite()will also always returnTRUE.- Specified by:
- isOrthogonalin interface- State<S,- E> 
- Returns:
- true, if state is an orthogonal state
 
- 
isSimplepublic boolean isSimple()Description copied from interface:StateChecks if state is a simple state. A simple state does not have any regions and it does not refer to any submachine state machine.
- 
isSubmachineStatepublic boolean isSubmachineState()Description copied from interface:StateChecks if state is a submachine state. This kind of state refers to a state machine(submachine).- Specified by:
- isSubmachineStatein interface- State<S,- E> 
- Returns:
- true, if state is a submachine state
 
- 
addStateListenerDescription copied from interface:StateAdds the state listener.- Specified by:
- addStateListenerin interface- State<S,- E> 
- Parameters:
- listener- the listener
 
- 
removeStateListenerDescription copied from interface:StateRemoves the state listener.- Specified by:
- removeStateListenerin interface- State<S,- E> 
- Parameters:
- listener- the listener
 
- 
addActionListenerDescription copied from interface:StateAdds the action listener.- Specified by:
- addActionListenerin interface- State<S,- E> 
- Parameters:
- listener- the listener
 
- 
removeActionListenerDescription copied from interface:StateRemoves the action listener.- Specified by:
- removeActionListenerin interface- State<S,- E> 
- Parameters:
- listener- the listener
 
- 
doPreStartReactivelyDescription copied from class:LifecycleObjectSupportSubclasses may implement this for pre start logic.- Overrides:
- doPreStartReactivelyin class- LifecycleObjectSupport
- Returns:
- the mono for completion
 
- 
doPreStopReactivelyDescription copied from class:LifecycleObjectSupportSubclasses may implement this for pre stop logic.- Overrides:
- doPreStopReactivelyin class- LifecycleObjectSupport
- Returns:
- the mono for completion
 
- 
getSubmachineGets the submachine.- Returns:
- the submachine or null if not set
 
- 
getRegionsGets the regions.- Returns:
- the regions or empty collection if no regions
 
- 
setTriggersSets the triggers.- Parameters:
- triggers- the triggers
 
- 
getTriggersGets the triggers.- Returns:
- the triggers
 
- 
setStateDoActionPolicy
- 
setStateDoActionPolicyTimeout
- 
armTriggersprotected void armTriggers()Arm triggers.
- 
disarmTriggersprotected void disarmTriggers()Disarm triggers.
- 
executeActionprotected reactor.core.publisher.Mono<Void> executeAction(Function<StateContext<S, E>, reactor.core.publisher.Mono<Void>> action, StateContext<S, E> context) Execute action and notify action listener if set.- Parameters:
- action- the action
- context- the context
- Returns:
- mono for completion
 
- 
handleStateDoOnComplete
- 
notifyStateOnComplete
- 
toString
 
-