Type Parameters:
COMMAND - The type of Commands that the handle(Object, Object) can process
EVENT - The type of Events that can be returned by handle(Object, Object) and applied in the StateEvolver.applyEvent(Object, Object)
ERROR - The type of Error that can be returned by the handle(Object, Object) method
STATE - The type of Aggregate State that this Decider works with in handle(Object, Object), InitialStateProvider.initialState(), StateEvolver.applyEvent(Object, Object) and IsStateFinalResolver.isFinal(Object)
All Known Subinterfaces:
Decider<COMMAND,EVENT,ERROR,STATE>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Handler<COMMAND,EVENT,ERROR,STATE>
Decider related interface that is responsible for handling 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
    handle(COMMAND cmd, STATE state)
    The execute method is responsible for handling a COMMAND, which can either result in an ERROR or a list of EVENT's (can be an empty list).
    Note: This method is called decide in the decider pattern
    Idempotent handling of a COMMAND will result in an empty list of EVENT's
  • Method Details

    • handle

      HandlerResult<ERROR,EVENT> handle(COMMAND cmd, STATE state)
      The execute method is responsible for handling a COMMAND, which can either result in an ERROR or a list of EVENT's (can be an empty list).
      Note: This method is called decide in the decider pattern
      Idempotent handling of a COMMAND will result in an empty list of EVENT's
      Parameters:
      cmd - the command to handle
      state - the state of the aggregate
      Returns:
      either an ERROR or a list of EVENT's.
      Idempotent handling of a COMMAND will result in an empty list of EVENT's