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

  • All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product
    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, java.io.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 Summary

      Constructors 
      Constructor Description
      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.immutable.Seq<E> domainEvents, scala.Function1<D,​scala.runtime.BoxedUnit> afterTransitionDo, boolean notifies)  
    • 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.immutable.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.
      • 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.immutable.Seq<E> domainEvents()
      • afterTransitionDo

        public scala.Function1<D,​scala.runtime.BoxedUnit> afterTransitionDo()
      • 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.

      • 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.

      • replying

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

        Returns:
        this state transition descriptor
      • applying

        public PersistentFSM.State<S,​D,​E> applying​(scala.collection.immutable.Seq<E> events)
        Specify domain events to be applied when transitioning to the new state.
      • 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
      • copy

        public <S,​D,​E> 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,
                                                                               scala.collection.immutable.Seq<E> domainEvents,
                                                                               scala.Function1<D,​scala.runtime.BoxedUnit> afterTransitionDo,
                                                                               boolean notifies)
      • copy$default$1

        public <S,​D,​E> S copy$default$1()
      • copy$default$2

        public <S,​D,​E> D copy$default$2()
      • copy$default$3

        public <S,​D,​E> scala.Option<scala.concurrent.duration.FiniteDuration> copy$default$3()
      • copy$default$5

        public <S,​D,​E> scala.collection.immutable.List<java.lang.Object> copy$default$5()
      • copy$default$6

        public <S,​D,​E> scala.collection.immutable.Seq<E> copy$default$6()
      • copy$default$7

        public <S,​D,​E> scala.Function1<D,​scala.runtime.BoxedUnit> copy$default$7()
      • 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
      • productElementName

        public java.lang.String productElementName​(int x$1)
        Specified by:
        productElementName in interface scala.Product
      • 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