Packages

final class EventHandlerBuilderByState[S <: State, State >: Null, Event] extends AnyRef

Source
EventHandler.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EventHandlerBuilderByState
  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 EventHandlerBuilderByState(stateClass: Class[S], statePredicate: Predicate[S])

Value Members

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

    Builds and returns a handler from the appended states.

    Builds and returns a handler from the appended states. The returned EventHandler will throw a scala.MatchError if applied to an event that has no defined case.

  2. def matchAny(handler: Function[Event, State]): EventHandler[State, Event]

    Match any event.

    Match any event.

    Use this when then State is not needed in the handler, otherwise there is an overloaded method that pass the state in a BiFunction.

    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 matchAny as it will match any event. This method builds and returns the event handler since this will not let through any states to subsequent match statements.

    returns

    An EventHandler from the appended states.

  3. def matchAny(handler: BiFunction[State, Event, State]): EventHandler[State, Event]

    Match any event.

    Match any event.

    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 matchAny as it will match any event. This method builds and returns the event handler since this will not let through any states to subsequent match statements.

    returns

    An EventHandler from the appended states.

  4. def matchEvent[E <: Event](eventClass: Class[E], handler: Supplier[State]): EventHandlerBuilderByState[S, State, Event]

    Match any event which is an instance of E or a subtype of E.

    Match any event which is an instance of E or a subtype of E.

    Use this when then State and the Event are not needed in the handler.

    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.

  5. def matchEvent[E <: Event](eventClass: Class[E], handler: Function[E, State]): EventHandlerBuilderByState[S, State, Event]

    Match any event which is an instance of E or a subtype of E.

    Match any event which is an instance of E or a subtype of E.

    Use this when then State is not needed in the handler, otherwise there is an overloaded method that pass the state in a BiFunction.

    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.

  6. def matchEvent[E <: Event](eventClass: Class[E], handler: BiFunction[S, E, State]): EventHandlerBuilderByState[S, State, Event]

    Match any event which is an instance of E or a subtype of E.

    Match any event which is an instance of E or a subtype of E.

    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.

  7. def orElse[S2 <: State](other: EventHandlerBuilderByState[S2, State, Event]): EventHandlerBuilderByState[S2, State, Event]

    Compose this builder with another builder.

    Compose this builder with another builder. The handlers in this builder will be tried first followed by the handlers in other.