Class PersistentFSM.State<S,​D,​E>

  • All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product, scala.Serializable
    Enclosing interface:
    PersistentFSM<S extends PersistentFSM.FSMState,​D,​E>

    public static final class PersistentFSM.State<S,​D,​E>
    extends java.lang.Object
    implements scala.Product, scala.Serializable
    This captures all of the managed state of the FSM: the state name, the state data, possibly custom timeout, stop reason, replies accumulated while processing the last message, possibly domain event and handler to be executed after FSM moves to the new state (also triggered when staying in the same state)
    See Also:
    Serialized Form
    • Constructor Detail

      • State

        public State​(S stateName,
                     D stateData,
                     scala.Option<scala.concurrent.duration.FiniteDuration> timeout,
                     scala.Option<PersistentFSM.Reason> stopReason,
                     scala.collection.immutable.List<java.lang.Object> replies,
                     scala.collection.Seq<E> domainEvents,
                     scala.Function1<D,​scala.runtime.BoxedUnit> afterTransitionDo,
                     boolean notifies)
    • Method Detail

      • applying

        public PersistentFSM.State<S,​D,​E> applying​(java.lang.Object... events)
        Specify domain events to be applied when transitioning to the new state.
        Parameters:
        events - (undocumented)
        Returns:
        (undocumented)
      • stateName

        public S stateName()
      • stateData

        public D stateData()
      • timeout

        public scala.Option<scala.concurrent.duration.FiniteDuration> timeout()
      • replies

        public scala.collection.immutable.List<java.lang.Object> replies()
      • domainEvents

        public scala.collection.Seq<E> domainEvents()
      • afterTransitionDo

        public scala.Function1<D,​scala.runtime.BoxedUnit> afterTransitionDo()
      • notifies

        public boolean notifies()
      • copy

        public PersistentFSM.State<S,​D,​E> copy​(S stateName,
                                                           D stateData,
                                                           scala.Option<scala.concurrent.duration.FiniteDuration> timeout,
                                                           scala.Option<PersistentFSM.Reason> stopReason,
                                                           scala.collection.immutable.List<java.lang.Object> replies,
                                                           boolean notifies,
                                                           scala.collection.Seq<E> domainEvents,
                                                           scala.Function1<D,​scala.runtime.BoxedUnit> afterTransitionDo)
        Copy object and update values if needed.
        Parameters:
        stateName - (undocumented)
        stateData - (undocumented)
        timeout - (undocumented)
        stopReason - (undocumented)
        replies - (undocumented)
        notifies - (undocumented)
        domainEvents - (undocumented)
        afterTransitionDo - (undocumented)
        Returns:
        (undocumented)
      • copy$default$1

        public S copy$default$1()
      • copy$default$2

        public D copy$default$2()
      • copy$default$3

        public scala.Option<scala.concurrent.duration.FiniteDuration> copy$default$3()
      • copy$default$5

        public scala.collection.immutable.List<java.lang.Object> copy$default$5()
      • copy$default$6

        public boolean copy$default$6()
      • copy$default$7

        public scala.collection.Seq<E> copy$default$7()
      • copy$default$8

        public scala.Function1<D,​scala.runtime.BoxedUnit> copy$default$8()
      • forMax

        public PersistentFSM.State<S,​D,​E> forMax​(scala.concurrent.duration.Duration timeout)
        Modify state transition descriptor to include a state timeout for the next state. This timeout overrides any default timeout set for the next state.

        Use Duration.Inf to deactivate an existing timeout.

        Parameters:
        timeout - (undocumented)
        Returns:
        (undocumented)
      • forMax

        public PersistentFSM.State<S,​D,​E> forMax​(java.time.Duration timeout)
        Java API: Modify state transition descriptor to include a state timeout for the next state. This timeout overrides any default timeout set for the next state.

        Use Duration.Inf to deactivate an existing timeout.

        Parameters:
        timeout - (undocumented)
        Returns:
        (undocumented)
      • replying

        public PersistentFSM.State<S,​D,​E> replying​(java.lang.Object replyValue)
        Send reply to sender of the current message, if available.

        Parameters:
        replyValue - (undocumented)
        Returns:
        this state transition descriptor
      • using

        public PersistentFSM.State<S,​D,​E> using​(D nextStateData)
        Deprecated.
        Internal API easily to be confused with regular FSM's using. Use regular events (`applying`). Internally, `copy` can be used instead. Since 2.5.5.
      • applying

        public PersistentFSM.State<S,​D,​E> applying​(scala.collection.Seq<E> events)
        Specify domain events to be applied when transitioning to the new state.
        Parameters:
        events - (undocumented)
        Returns:
        (undocumented)
      • andThen

        public PersistentFSM.State<S,​D,​E> andThen​(scala.Function1<D,​scala.runtime.BoxedUnit> handler)
        Register a handler to be triggered after the state has been persisted successfully
        Parameters:
        handler - (undocumented)
        Returns:
        (undocumented)
      • productPrefix

        public java.lang.String productPrefix()
        Specified by:
        productPrefix in interface scala.Product
      • productArity

        public int productArity()
        Specified by:
        productArity in interface scala.Product
      • productElement

        public java.lang.Object productElement​(int x$1)
        Specified by:
        productElement in interface scala.Product
      • productIterator

        public scala.collection.Iterator<java.lang.Object> productIterator()
        Specified by:
        productIterator in interface scala.Product
      • canEqual

        public boolean canEqual​(java.lang.Object x$1)
        Specified by:
        canEqual in interface scala.Equals
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object x$1)
        Specified by:
        equals in interface scala.Equals
        Overrides:
        equals in class java.lang.Object