Class RegionState<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

public class RegionState<S,E> extends AbstractState<S,E>
A State implementation where states are wrapped in a regions..
  • Constructor Details

    • RegionState

      public RegionState(S id, Collection<Region<S,E>> regions)
      Instantiates a new region state.
      Parameters:
      id - the state identifier
      regions - the regions
    • RegionState

      public RegionState(S id, Collection<Region<S,E>> regions, Collection<E> deferred)
      Instantiates a new region state.
      Parameters:
      id - the state identifier
      regions - the regions
      deferred - the deferred
    • RegionState

      public RegionState(S id, Collection<Region<S,E>> regions, PseudoState<S,E> pseudoState)
      Instantiates a new region state.
      Parameters:
      id - the state identifier
      regions - the regions
      pseudoState - the pseudo state
    • RegionState

      public RegionState(S id, Collection<Region<S,E>> regions, 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 region state.
      Parameters:
      id - the state identifier
      regions - the regions
      deferred - the deferred
      entryActions - the entry actions
      exitActions - the exit actions
      pseudoState - the pseudo state
    • RegionState

      public RegionState(S id, Collection<Region<S,E>> regions, 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 region state.
      Parameters:
      id - the state identifier
      regions - the regions
      deferred - the deferred
      entryActions - the entry actions
      exitActions - the exit actions
  • Method Details

    • sendEvent

      public reactor.core.publisher.Flux<StateMachineEventResult<S,E>> sendEvent(org.springframework.messaging.Message<E> event)
      Description copied from interface: State
      Send an event E wrapped with a Message to the state and return a StateMachineEventResult for results.
      Specified by:
      sendEvent in interface State<S,E>
      Overrides:
      sendEvent in class AbstractState<S,E>
      Parameters:
      event - the wrapped event to send
      Returns:
      the state machine event results
    • shouldDefer

      public boolean shouldDefer(org.springframework.messaging.Message<E> event)
      Description copied from interface: State
      Checks if state wants to defer an event.
      Specified by:
      shouldDefer in interface State<S,E>
      Overrides:
      shouldDefer in class AbstractState<S,E>
      Parameters:
      event - the wrapped event
      Returns:
      true if event should be deferred
    • exit

      public reactor.core.publisher.Mono<Void> exit(StateContext<S,E> context)
      Description copied from interface: State
      Initiate an exit sequence for the state.
      Specified by:
      exit in interface State<S,E>
      Overrides:
      exit in class AbstractState<S,E>
      Parameters:
      context - the state context
      Returns:
      Mono for completion
    • entry

      public reactor.core.publisher.Mono<Void> entry(StateContext<S,E> context)
      Description copied from interface: State
      Initiate an entry sequence for the state.
      Specified by:
      entry in interface State<S,E>
      Overrides:
      entry in class AbstractState<S,E>
      Parameters:
      context - the state context
      Returns:
      Mono for completion
    • getIds

      public Collection<S> getIds()
      Description copied from interface: State
      Gets the state identifiers. Usually returned collection contains only one identifier except in a case where state is an orthogonal.
      Specified by:
      getIds in interface State<S,E>
      Specified by:
      getIds in class AbstractState<S,E>
      Returns:
      the state identifiers
    • getStates

      public Collection<State<S,E>> getStates()
      Description copied from interface: State
      Gets all possible states this state knows about including itself and substates.
      Specified by:
      getStates in interface State<S,E>
      Specified by:
      getStates in class AbstractState<S,E>
      Returns:
      all state including itself and nested states
    • setRegionExecutionPolicy

      public void setRegionExecutionPolicy(RegionExecutionPolicy regionExecutionPolicy)
      Sets the region execution policy.
      Parameters:
      regionExecutionPolicy - the new region execution policy
    • toString

      public String toString()
      Overrides:
      toString in class AbstractState<S,E>