Interface StateContext<S,E>

All Known Implementing Classes:
DefaultStateContext

public interface StateContext<S,E>
StateContext is representing of a current context used in various stages in a state machine execution. These include for example Transitions, Actions and Guards order to get access to event headers and ExtendedState.

Context really is not a current state of a state machine but more like a snapshot of where state machine is when this context is passed to various methods.

  • Method Details

    • getStage

      StateContext.Stage getStage()
      Gets the stage this context is attached.
      Returns:
      the stage
    • getMessage

      org.springframework.messaging.Message<E> getMessage()
      Gets the message associated with a context. Message may be null if transition is not triggered by a signal.
      Returns:
      the message
    • getEvent

      E getEvent()
      Gets the event associated with a context. Event may be null if transition is not triggered by a signal.
      Returns:
      the event
    • getMessageHeaders

      org.springframework.messaging.MessageHeaders getMessageHeaders()
      Gets the event message headers.
      Returns:
      the event message headers
    • getMessageHeader

      Object getMessageHeader(Object header)
      Gets the message header. If header is not a String object's Object.toString() method is used to resolve a key name.
      Parameters:
      header - the header
      Returns:
      the message header
    • getExtendedState

      ExtendedState getExtendedState()
      Gets the state machine extended state.
      Returns:
      the state machine extended state
    • getTransition

      Transition<S,E> getTransition()
      Gets the transition.
      Returns:
      the transition
    • getStateMachine

      StateMachine<S,E> getStateMachine()
      Gets the state machine.
      Returns:
      the state machine
    • getSource

      State<S,E> getSource()
      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.
      Returns:
      the source state
    • getSources

      Collection<State<S,E>> getSources()
      Gets the source states of this context. Multiple sources are only valid during a context when machine is joining from multiple orthogonal regions.
      Returns:
      the source state
      See Also:
    • getTarget

      State<S,E> getTarget()
      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.
      Returns:
      the target state
    • getTargets

      Collection<State<S,E>> getTargets()
      Gets the target states of this context. Multiple targets are only valid during a context when machine is forking into multiple orthogonal regions.
      Returns:
      the target states
      See Also:
    • getException

      Exception getException()
      Gets the exception associated with a context.
      Returns:
      the exception