S
- the state typeD
- the data typeE
- the domain event type
This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.public class FSMStateFunctionBuilder<S,D,E>
extends java.lang.Object
FSM.whenUnhandled(scala.PartialFunction<akka.actor.FSM.Event<D>, akka.actor.FSM.State<S, D>>)
.Constructor and Description |
---|
FSMStateFunctionBuilder() |
Modifier and Type | Method and Description |
---|---|
FSMStateFunctionBuilder<S,D,E> |
anyEvent(FI.Apply2<java.lang.Object,D,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches on any type of event.
|
scala.PartialFunction<PersistentFSM.Event<D>,PersistentFSM.State<S,D,E>> |
build()
Build a
PartialFunction from this builder. |
<P,Q> FSMStateFunctionBuilder<S,D,E> |
event(java.lang.Class<P> eventType,
java.lang.Class<Q> dataType,
FI.Apply2<P,Q,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches on an event and data type.
|
<P,Q> FSMStateFunctionBuilder<S,D,E> |
event(java.lang.Class<P> eventType,
java.lang.Class<Q> dataType,
FI.TypedPredicate2<P,Q> predicate,
FI.Apply2<P,Q,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches on an event and data type and a predicate.
|
<P> FSMStateFunctionBuilder<S,D,E> |
event(java.lang.Class<P> eventType,
FI.Apply2<P,D,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches if the event type and predicate matches.
|
<P> FSMStateFunctionBuilder<S,D,E> |
event(java.lang.Class<P> eventType,
FI.TypedPredicate2<P,D> predicate,
FI.Apply2<P,D,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches if the event type and predicate matches.
|
FSMStateFunctionBuilder<S,D,E> |
event(FI.TypedPredicate2<java.lang.Object,D> predicate,
FI.Apply2<java.lang.Object,D,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches if the predicate matches.
|
<Q> FSMStateFunctionBuilder<S,D,E> |
event(java.util.List<java.lang.Object> eventMatches,
java.lang.Class<Q> dataType,
FI.Apply2<java.lang.Object,Q,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches on the data type and if any of the event types
in the list match or any of the event instances in the list compares equal.
|
FSMStateFunctionBuilder<S,D,E> |
event(java.util.List<java.lang.Object> eventMatches,
FI.Apply2<java.lang.Object,D,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches if any of the event types in the list match or
any of the event instances in the list compares equal.
|
<P,Q> FSMStateFunctionBuilder<S,D,E> |
eventEquals(P event,
java.lang.Class<Q> dataType,
FI.Apply2<P,Q,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches on the data type and if the event compares equal.
|
<P> FSMStateFunctionBuilder<S,D,E> |
eventEquals(P event,
FI.Apply2<P,D,PersistentFSM.State<S,D,E>> apply)
Add a case statement that matches if event compares equal.
|
public final <P,Q> FSMStateFunctionBuilder<S,D,E> event(java.lang.Class<P> eventType, java.lang.Class<Q> dataType, FI.TypedPredicate2<P,Q> predicate, FI.Apply2<P,Q,PersistentFSM.State<S,D,E>> apply)
P
- the event type to match onQ
- the data type to match oneventType
- the event type to match ondataType
- the data type to match onpredicate
- a predicate to evaluate on the matched typesapply
- an action to apply to the event and state data if there is a matchpublic <P,Q> FSMStateFunctionBuilder<S,D,E> event(java.lang.Class<P> eventType, java.lang.Class<Q> dataType, FI.Apply2<P,Q,PersistentFSM.State<S,D,E>> apply)
P
- the event type to match onQ
- the data type to match oneventType
- the event type to match ondataType
- the data type to match onapply
- an action to apply to the event and state data if there is a matchpublic <P> FSMStateFunctionBuilder<S,D,E> event(java.lang.Class<P> eventType, FI.TypedPredicate2<P,D> predicate, FI.Apply2<P,D,PersistentFSM.State<S,D,E>> apply)
eventType
- the event type to match onpredicate
- a predicate that will be evaluated on the data and the eventapply
- an action to apply to the event and state data if there is a matchpublic <P> FSMStateFunctionBuilder<S,D,E> event(java.lang.Class<P> eventType, FI.Apply2<P,D,PersistentFSM.State<S,D,E>> apply)
eventType
- the event type to match onapply
- an action to apply to the event and state data if there is a matchpublic FSMStateFunctionBuilder<S,D,E> event(FI.TypedPredicate2<java.lang.Object,D> predicate, FI.Apply2<java.lang.Object,D,PersistentFSM.State<S,D,E>> apply)
predicate
- a predicate that will be evaluated on the data and the eventapply
- an action to apply to the event and state data if there is a matchpublic <Q> FSMStateFunctionBuilder<S,D,E> event(java.util.List<java.lang.Object> eventMatches, java.lang.Class<Q> dataType, FI.Apply2<java.lang.Object,Q,PersistentFSM.State<S,D,E>> apply)
Q
- the data type to match oneventMatches
- a list of types or instances to match againstdataType
- the data type to match onapply
- an action to apply to the event and state data if there is a matchpublic FSMStateFunctionBuilder<S,D,E> event(java.util.List<java.lang.Object> eventMatches, FI.Apply2<java.lang.Object,D,PersistentFSM.State<S,D,E>> apply)
eventMatches
- a list of types or instances to match againstapply
- an action to apply to the event and state data if there is a matchpublic <P,Q> FSMStateFunctionBuilder<S,D,E> eventEquals(P event, java.lang.Class<Q> dataType, FI.Apply2<P,Q,PersistentFSM.State<S,D,E>> apply)
Q
- the data type to match onevent
- an event to compare equal againstdataType
- the data type to match onapply
- an action to apply to the event and state data if there is a matchpublic <P> FSMStateFunctionBuilder<S,D,E> eventEquals(P event, FI.Apply2<P,D,PersistentFSM.State<S,D,E>> apply)
event
- an event to compare equal againstapply
- an action to apply to the event and state data if there is a matchpublic FSMStateFunctionBuilder<S,D,E> anyEvent(FI.Apply2<java.lang.Object,D,PersistentFSM.State<S,D,E>> apply)
apply
- an action to apply to the event and state datapublic scala.PartialFunction<PersistentFSM.Event<D>,PersistentFSM.State<S,D,E>> build()
PartialFunction
from this builder.
After this call the builder will be reset.