final class CommandHandlerBuilder[Command, State] extends AnyRef

Source
CommandHandler.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CommandHandlerBuilder
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new CommandHandlerBuilder()

Value Members

  1. def build(): CommandHandler[Command, State]
  2. def forAnyState(): CommandHandlerBuilderByState[Command, State, State]

    The handlers defined by this builder are used for any state.

    The handlers defined by this builder are used for any state. This variant is particular useful for models that have a single type (ie: no class hierarchy).

    Note: command handlers are selected in the order they are added. Once a matching is found, it's selected for handling the command and no further lookup is done. Therefore you must make sure that their matching conditions don't overlap, otherwise you risk to 'shadow' part of your command handlers. Extra care should be taken when using forAnyState as it will match any state. Any command handler define after it will never be reached.

    returns

    A new, mutable, CommandHandlerBuilderByState

  3. def forNonNullState(): CommandHandlerBuilderByState[Command, State, State]

    The handlers defined by this builder are used for any not null state.

    The handlers defined by this builder are used for any not null state.

    Note: command handlers are selected in the order they are added. Once a matching is found, it's selected for handling the command and no further lookup is done. Therefore you must make sure that their matching conditions don't overlap, otherwise you risk to 'shadow' part of your command handlers.

    returns

    A new, mutable, CommandHandlerBuilderByState

  4. def forNullState(): CommandHandlerBuilderByState[Command, State, State]

    The handlers defined by this builder are used when the state is null.

    The handlers defined by this builder are used when the state is null. This variant is particular useful when the empty state of your model is defined as null.

    Note: command handlers are selected in the order they are added. Once a matching is found, it's selected for handling the command and no further lookup is done. Therefore you must make sure that their matching conditions don't overlap, otherwise you risk to 'shadow' part of your command handlers.

    returns

    A new, mutable, CommandHandlerBuilderByState

  5. def forState[S <: State](stateClass: Class[S], statePredicate: Predicate[S]): CommandHandlerBuilderByState[Command, S, State]

    Use this method to define command handlers that are selected when the passed predicate holds true for a given subtype of your model.

    Use this method to define command handlers that are selected when the passed predicate holds true for a given subtype of your model. Useful when the model is defined as class hierarchy.

    Note: command handlers are selected in the order they are added. Once a matching is found, it's selected for handling the command and no further lookup is done. Therefore you must make sure that their matching conditions don't overlap, otherwise you risk to 'shadow' part of your command handlers.

    stateClass

    The handlers defined by this builder are used when the state is an instance of the stateClass

    statePredicate

    The handlers defined by this builder are used when the statePredicate is true

    returns

    A new, mutable, CommandHandlerBuilderByState

  6. def forState(statePredicate: Predicate[State]): CommandHandlerBuilderByState[Command, State, State]

    Use this method to define command handlers that are selected when the passed predicate holds true.

    Use this method to define command handlers that are selected when the passed predicate holds true.

    Note: command handlers are selected in the order they are added. Once a matching is found, it's selected for handling the command and no further lookup is done. Therefore you must make sure that their matching conditions don't overlap, otherwise you risk to 'shadow' part of your command handlers.

    statePredicate

    The handlers defined by this builder are used when the statePredicate is true

    returns

    A new, mutable, CommandHandlerBuilderByState

  7. def forStateType[S <: State](stateClass: Class[S]): CommandHandlerBuilderByState[Command, S, State]

    Use this method to define command handlers for a given subtype of your model.

    Use this method to define command handlers for a given subtype of your model. Useful when the model is defined as class hierarchy.

    Note: command handlers are selected in the order they are added. Once a matching is found, it's selected for handling the command and no further lookup is done. Therefore you must make sure that their matching conditions don't overlap, otherwise you risk to 'shadow' part of your command handlers.

    stateClass

    The handlers defined by this builder are used when the state is an instance of the stateClass.

    returns

    A new, mutable, CommandHandlerBuilderByState