Interface EventHandlerRegistry<S extends EventHandlerRegistry<S>>

Type Parameters:
S - The type of the registry itself, used for fluent interfacing.
All Known Implementing Classes:
SimpleEventHandlingComponent

public interface EventHandlerRegistry<S extends EventHandlerRegistry<S>>
Interface describing a registry of event handlers.
Since:
5.0.0
Author:
Allard Buijze, Gerard Klijs, Milan Savic, Mitchell Herrijgers, Sara Pellegrini, Steven van Beelen
  • Method Details

    • subscribe

      default S subscribe(@Nonnull Set<QualifiedName> names, @Nonnull EventHandler eventHandler)
      Subscribe the given handler for events of the given names.

      If a subscription already exists for any name in the given set, the behavior is undefined. Implementations may throw an exception to refuse duplicate subscription or alternatively decide whether the existing or new handler gets the subscription.

      Parameters:
      names - The names of the given commandHandler can handle.
      eventHandler - The handler instance that handles events for the given names.
      Returns:
      This registry for fluent interfacing.
    • subscribe

      S subscribe(@Nonnull QualifiedName name, @Nonnull EventHandler eventHandler)
      Subscribe the given handler for events of the given name.

      If a subscription already exists for the name, the behavior is undefined. Implementations may throw an exception to refuse duplicate subscription or alternatively decide whether the existing or new handler gets the subscription.

      Parameters:
      name - The name the given commandHandler can handle.
      eventHandler - The handler instance that handles events for the given name.
      Returns:
      This registry for fluent interfacing.
    • subscribe

      default S subscribe(@Nonnull EventHandlingComponent handlingComponent)
      Subscribe the given handlingComponent with this registry.

      Typically invokes subscribe(Set, EventHandler), using the EventHandlingComponent.supportedEvents() as the set of compatible names the component in question can deal with.

      Parameters:
      handlingComponent - The event handling component instance to subscribe with this registry.
      Returns:
      This registry for fluent interfacing.