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.- Author:
- Janne Valkealahti
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidpostStateChange(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.voidpreStateChange(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:StateMachineInterceptorCalled before message is sent to processing. Throwing exception or returning null will skip the message.- Specified by:
preEventin 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:StateMachineInterceptorCalled prior of a state change. Throwing an exception from this method will stop a state change logic.- Specified by:
preStateChangein 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:StateMachineInterceptorCalled after a state change.- Specified by:
postStateChangein interfaceStateMachineInterceptor<S,E> - Parameters:
state- the statemessage- the messagetransition- the transitionstateMachine- the state machinerootStateMachine- the root state machine
-
preTransition
Description copied from interface:StateMachineInterceptorCalled prior of a start of a transition. Returningnullfrom this method will break the transtion chain.- Specified by:
preTransitionin interfaceStateMachineInterceptor<S,E> - Parameters:
stateContext- the state context- Returns:
- the state context
-
postTransition
Description copied from interface:StateMachineInterceptorCalled after of a transition if transition happened.- Specified by:
postTransitionin interfaceStateMachineInterceptor<S,E> - Parameters:
stateContext- the state context- Returns:
- the state context
-
stateMachineError
Description copied from interface:StateMachineInterceptorState when state machine is about to enter error it can't recover.- Specified by:
stateMachineErrorin interfaceStateMachineInterceptor<S,E> - Parameters:
stateMachine- the state machineexception- the exception- Returns:
- the exception
-