Class StateMachineInterceptorAdapter<S,E>
java.lang.Object
org.springframework.statemachine.support.StateMachineInterceptorAdapter<S,E>
- Type Parameters:
S
- the type of stateE
- the type of event
- All Implemented Interfaces:
StateMachineInterceptor<S,
E>
- Direct Known Subclasses:
AbstractPersistingStateMachineInterceptor
,StateMachineSecurityInterceptor
public class StateMachineInterceptorAdapter<S,E>
extends Object
implements StateMachineInterceptor<S,E>
Adapter helper implementation for
StateMachineInterceptor
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
postStateChange
(State<S, E> state, org.springframework.messaging.Message<E> message, Transition<S, E> transition, StateMachine<S, E> stateMachine, StateMachine<S, E> rootStateMachine) Called after a state change.postTransition
(StateContext<S, E> stateContext) Called after of a transition if transition happened.org.springframework.messaging.Message<E>
preEvent
(org.springframework.messaging.Message<E> message, StateMachine<S, E> stateMachine) Called before message is sent to processing.void
preStateChange
(State<S, E> state, org.springframework.messaging.Message<E> message, Transition<S, E> transition, StateMachine<S, E> stateMachine, StateMachine<S, E> rootStateMachine) Called prior of a state change.preTransition
(StateContext<S, E> stateContext) Called prior of a start of a transition.stateMachineError
(StateMachine<S, E> stateMachine, Exception exception) State when state machine is about to enter error it can't recover.
-
Constructor Details
-
StateMachineInterceptorAdapter
public StateMachineInterceptorAdapter()
-
-
Method Details
-
preEvent
public org.springframework.messaging.Message<E> preEvent(org.springframework.messaging.Message<E> message, StateMachine<S, E> stateMachine) Description copied from interface:StateMachineInterceptor
Called before message is sent to processing. Throwing exception or returning null will skip the message.- Specified by:
preEvent
in interfaceStateMachineInterceptor<S,
E> - Parameters:
message
- the messagestateMachine
- the state machine- Returns:
- the intercepted message
-
preStateChange
public void preStateChange(State<S, E> state, org.springframework.messaging.Message<E> message, Transition<S, E> transition, StateMachine<S, E> stateMachine, StateMachine<S, E> rootStateMachine) Description copied from interface:StateMachineInterceptor
Called prior of a state change. Throwing an exception from this method will stop a state change logic.- Specified by:
preStateChange
in interfaceStateMachineInterceptor<S,
E> - Parameters:
state
- the statemessage
- the messagetransition
- the transitionstateMachine
- the state machinerootStateMachine
- the root state machine
-
postStateChange
public void postStateChange(State<S, E> state, org.springframework.messaging.Message<E> message, Transition<S, E> transition, StateMachine<S, E> stateMachine, StateMachine<S, E> rootStateMachine) Description copied from interface:StateMachineInterceptor
Called after a state change.- Specified by:
postStateChange
in interfaceStateMachineInterceptor<S,
E> - Parameters:
state
- the statemessage
- the messagetransition
- the transitionstateMachine
- the state machinerootStateMachine
- the root state machine
-
preTransition
Description copied from interface:StateMachineInterceptor
Called prior of a start of a transition. Returningnull
from this method will break the transtion chain.- Specified by:
preTransition
in interfaceStateMachineInterceptor<S,
E> - Parameters:
stateContext
- the state context- Returns:
- the state context
-
postTransition
Description copied from interface:StateMachineInterceptor
Called after of a transition if transition happened.- Specified by:
postTransition
in interfaceStateMachineInterceptor<S,
E> - Parameters:
stateContext
- the state context- Returns:
- the state context
-
stateMachineError
Description copied from interface:StateMachineInterceptor
State when state machine is about to enter error it can't recover.- Specified by:
stateMachineError
in interfaceStateMachineInterceptor<S,
E> - Parameters:
stateMachine
- the state machineexception
- the exception- Returns:
- the exception
-