Package io.hektor.fsm

Interface Definition<S extends Enum<S>,C extends Context,D extends Data>

All Known Implementing Classes:
DefinitionImpl

public interface Definition<S extends Enum<S>,C extends Context,D extends Data>
  • Method Details

    • newInstance

      FSM newInstance(Object uuid, C context, D data, BiConsumer<S,Object> onUnhandledEvent, TransitionListener<S> transitionListener)
      Create a new FSM based off of this Definition and assign a unique UUID to this state machine. The FSM itself doesn't actually use the UUID other but may be important for the applications who actually are using this FSM. Also pass in a handler for any events that doesn't match the FSM. This allows you to take action if there are any events that has been missed when creating the FSM. A common best practice is to at the very least log on WARN so your systems can alert you to the fact that your FSM is missing a transition.
      Parameters:
      uuid -
      context -
      data -
      onUnhandledEvent -
      Returns:
    • newInstance

      FSM newInstance(Object uuid, C context, D data)
      Parameters:
      uuid -
      Returns:
    • acceptVisitor

      void acceptVisitor(FsmVisitor<S,C,D> visitor)