Class DefaultStateContext<S,E>
java.lang.Object
org.springframework.statemachine.support.DefaultStateContext<S,E>
- Type Parameters:
S
- the type of stateE
- the type of event
- All Implemented Interfaces:
StateContext<S,
E>
Default implementation of a
StateContext
.- Author:
- Janne Valkealahti
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.statemachine.StateContext
StateContext.Stage
-
Constructor Summary
ConstructorDescriptionDefaultStateContext
(StateContext.Stage stage, org.springframework.messaging.Message<E> message, org.springframework.messaging.MessageHeaders messageHeaders, ExtendedState extendedState, Transition<S, E> transition, StateMachine<S, E> stateMachine, State<S, E> source, State<S, E> target, Exception exception) Instantiates a new default state context.DefaultStateContext
(StateContext.Stage stage, org.springframework.messaging.Message<E> message, org.springframework.messaging.MessageHeaders messageHeaders, ExtendedState extendedState, Transition<S, E> transition, StateMachine<S, E> stateMachine, State<S, E> source, State<S, E> target, Collection<State<S, E>> sources, Collection<State<S, E>> targets, Exception exception) Instantiates a new default state context. -
Method Summary
Modifier and TypeMethodDescriptiongetEvent()
Gets the event associated with a context.Gets the exception associated with a context.Gets the state machine extended state.org.springframework.messaging.Message<E>
Gets the message associated with a context.getMessageHeader
(Object header) Gets the message header.org.springframework.messaging.MessageHeaders
Gets the event message headers.Gets the source state of this context.Collection<State<S,
E>> Gets the source states of this context.getStage()
Gets the stage this context is attached.Gets the state machine.Gets the target state of this context.Collection<State<S,
E>> Gets the target states of this context.Transition<S,
E> Gets the transition.toString()
-
Constructor Details
-
DefaultStateContext
public DefaultStateContext(StateContext.Stage stage, org.springframework.messaging.Message<E> message, org.springframework.messaging.MessageHeaders messageHeaders, ExtendedState extendedState, Transition<S, E> transition, StateMachine<S, E> stateMachine, State<S, E> source, State<S, E> target, Exception exception) Instantiates a new default state context.- Parameters:
stage
- the stagemessage
- the messagemessageHeaders
- the message headersextendedState
- the extended statetransition
- the transitionstateMachine
- the state machinesource
- the sourcetarget
- the targetexception
- the exception
-
DefaultStateContext
public DefaultStateContext(StateContext.Stage stage, org.springframework.messaging.Message<E> message, org.springframework.messaging.MessageHeaders messageHeaders, ExtendedState extendedState, Transition<S, E> transition, StateMachine<S, E> stateMachine, State<S, E> source, State<S, E> target, Collection<State<S, E>> sources, Collection<State<S, E>> targets, Exception exception) Instantiates a new default state context.- Parameters:
stage
- the stagemessage
- the messagemessageHeaders
- the message headersextendedState
- the extended statetransition
- the transitionstateMachine
- the state machinesource
- the sourcetarget
- the targetsources
- the sourcestargets
- the targetsexception
- the exception
-
-
Method Details
-
getStage
Description copied from interface:StateContext
Gets the stage this context is attached.- Specified by:
getStage
in interfaceStateContext<S,
E> - Returns:
- the stage
-
getEvent
Description copied from interface:StateContext
Gets the event associated with a context. Event may be null if transition is not triggered by a signal.- Specified by:
getEvent
in interfaceStateContext<S,
E> - Returns:
- the event
-
getMessage
Description copied from interface:StateContext
Gets the message associated with a context. Message may be null if transition is not triggered by a signal.- Specified by:
getMessage
in interfaceStateContext<S,
E> - Returns:
- the message
-
getMessageHeaders
public org.springframework.messaging.MessageHeaders getMessageHeaders()Description copied from interface:StateContext
Gets the event message headers.- Specified by:
getMessageHeaders
in interfaceStateContext<S,
E> - Returns:
- the event message headers
-
getMessageHeader
Description copied from interface:StateContext
Gets the message header. If header is not aString
object'sObject.toString()
method is used to resolve a key name.- Specified by:
getMessageHeader
in interfaceStateContext<S,
E> - Parameters:
header
- the header- Returns:
- the message header
-
getExtendedState
Description copied from interface:StateContext
Gets the state machine extended state.- Specified by:
getExtendedState
in interfaceStateContext<S,
E> - Returns:
- the state machine extended state
-
getTransition
Description copied from interface:StateContext
Gets the transition.- Specified by:
getTransition
in interfaceStateContext<S,
E> - Returns:
- the transition
-
getStateMachine
Description copied from interface:StateContext
Gets the state machine.- Specified by:
getStateMachine
in interfaceStateContext<S,
E> - Returns:
- the state machine
-
getSource
Description copied from interface:StateContext
Gets the source state of this context. Generally source is where a state machine is coming from which may be different than what the transition source is.- Specified by:
getSource
in interfaceStateContext<S,
E> - Returns:
- the source state
-
getSources
Description copied from interface:StateContext
Gets the source states of this context. Multiple sources are only valid during a context when machine is joining from multiple orthogonal regions.- Specified by:
getSources
in interfaceStateContext<S,
E> - Returns:
- the source state
- See Also:
-
getTarget
Description copied from interface:StateContext
Gets the target state of this context. Generally target is where a state machine going to which may be different than what the transition target is.- Specified by:
getTarget
in interfaceStateContext<S,
E> - Returns:
- the target state
-
getTargets
Description copied from interface:StateContext
Gets the target states of this context. Multiple targets are only valid during a context when machine is forking into multiple orthogonal regions.- Specified by:
getTargets
in interfaceStateContext<S,
E> - Returns:
- the target states
- See Also:
-
getException
Description copied from interface:StateContext
Gets the exception associated with a context.- Specified by:
getException
in interfaceStateContext<S,
E> - Returns:
- the exception
-
toString
-