Packages

final class EventHandlerBuilder[State >: Null, Event] extends AnyRef

Source
EventHandler.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EventHandlerBuilder
  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. All

Instance Constructors

  1. new EventHandlerBuilder()

Value Members

  1. def build(): EventHandler[State, Event]
  2. def forAnyState(): EventHandlerBuilderByState[State, State, Event]

    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: event handlers are matched in the order they are added. Once a matching is found, it's selected for handling the event 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 event handlers. Extra care should be taken when using forAnyState as it will match any state. Any event handler define after it will never be reached.

    returns

    A new, mutable, EventHandlerBuilderByState

  3. def forNonNullState(): EventHandlerBuilderByState[State, State, Event]

    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: event handlers are matched in the order they are added. Once a matching is found, it's selected for handling the event 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 event handlers.

    returns

    A new, mutable, EventHandlerBuilderByState

  4. def forNullState(): EventHandlerBuilderByState[State, State, Event]

    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: event handlers are matched in the order they are added. Once a matching is found, it's selected for handling the event 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 event handlers.

    returns

    A new, mutable, EventHandlerBuilderByState

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

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

    Use this method to define event 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: event handlers are matched in the order they are added. Once a matching is found, it's selected for handling the event 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 event 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, EventHandlerBuilderByState

  6. def forState(statePredicate: Predicate[State]): EventHandlerBuilderByState[State, State, Event]

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

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

    Note: event handlers are matched in the order they are added. Once a matching is found, it's selected for handling the event 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 event handlers.

    statePredicate

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

    returns

    A new, mutable, EventHandlerBuilderByState

  7. def forStateType[S <: State](stateClass: Class[S]): EventHandlerBuilderByState[S, State, Event]

    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: event handlers are matched in the order they are added. Once a matching is found, it's selected for handling the event 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 event handlers.

    stateClass

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

    returns

    A new, mutable, EventHandlerBuilderByState