Interface Trigger<S,E>
- Type Parameters:
S
- the type of stateE
- the type of event
- All Known Implementing Classes:
EventTrigger
,TimerTrigger
public interface Trigger<S,E>
Trigger
is the cause of the Transition
. Cause is usually an
event but can be some other signal or a change in some condition.-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTriggerListener
(TriggerListener listener) Adds the trigger listener.void
arm()
Arm a trigger.void
disarm()
Disarm a trigger.reactor.core.publisher.Mono<Boolean>
evaluate
(TriggerContext<S, E> context) Evaluate trigger.getEvent()
Gets the event associated with this trigger.
-
Method Details
-
evaluate
Evaluate trigger.- Parameters:
context
- the context- Returns:
- Mono for completion with true, if trigger is fired, false otherwise
-
addTriggerListener
Adds the trigger listener.- Parameters:
listener
- the listener
-
getEvent
E getEvent()Gets the event associated with this trigger. It is possible that there are no event association.- Returns:
- the event
-
arm
void arm()Arm a trigger. After trigger has been armed aTriggerListener
may receive events. -
disarm
void disarm()Disarm a trigger. After trigger has been disarmed aTriggerListener
will not receive events.
-