Type Parameters:
COMMAND - The type of Commands that the Handler.handle(Object, Object) can process
EVENT - The type of Events that can be returned by Handler.handle(Object, Object) and applied in the StateEvolver.applyEvent(Object, Object)
ERROR - The type of Error that can be returned by the Handler.handle(Object, Object) method
STATE - The type of Aggregate State that this Decider works with in Handler.handle(Object, Object), InitialStateProvider.initialState(), StateEvolver.applyEvent(Object, Object) and isFinal(Object)
All Superinterfaces:
Handler<COMMAND,EVENT,ERROR,STATE>, InitialStateProvider<STATE>, IsStateFinalResolver<STATE>, StateEvolver<STATE,EVENT>

public interface Decider<COMMAND,EVENT,ERROR,STATE> extends Handler<COMMAND,EVENT,ERROR,STATE>, StateEvolver<STATE,EVENT>, InitialStateProvider<STATE>, IsStateFinalResolver<STATE>
Variant of the event sourced Decider pattern, which supports building an Aggregate STATE based on previous EVENT's that relate to the aggregate instance, and which can handle COMMAND's, whose side effect is either an ERROR or a List of EVENT's (can be an empty list)
  • Method Summary

    Modifier and Type
    Method
    Description
    static <COMMAND, EVENT, ERROR, STATE>
    Decider<COMMAND,EVENT,ERROR,STATE>
    decider(Handler<COMMAND,EVENT,ERROR,STATE> handler, InitialStateProvider<STATE> initialStateProvider, StateEvolver<STATE,EVENT> stateEvolver, IsStateFinalResolver<STATE> stateIsStateFinalResolver)
    Factory method for creating a Decider instance from instances of the various Decider related interfaces
    default boolean
    isFinal(STATE state)
    Return true from this method IF the aggregate's state is final and no more changes can occur, i.e.

    Methods inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.decider.Handler

    handle

    Methods inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.decider.InitialStateProvider

    initialState

    Methods inherited from interface dk.cloudcreate.essentials.components.eventsourced.aggregates.decider.StateEvolver

    applyEvent