Class EventBusSubscriptionDefinition<E extends Event>

java.lang.Object
io.vertigo.core.node.definition.AbstractDefinition<EventBusSubscriptionDefinition>
io.vertigo.commons.eventbus.definitions.EventBusSubscriptionDefinition<E>
Type Parameters:
E - type of event
All Implemented Interfaces:
io.vertigo.core.node.definition.Definition

public final class EventBusSubscriptionDefinition<E extends Event> extends io.vertigo.core.node.definition.AbstractDefinition<EventBusSubscriptionDefinition>
This defintion defines a subscripter in the eventbus pattern. A endpoint is : - a type of event - a way to consume the event.
Author:
pchretien
  • Field Details

  • Constructor Details

    • EventBusSubscriptionDefinition

      public EventBusSubscriptionDefinition(String name, Class<E> eventType, Consumer<E> eventListener)
      Constructor
      Parameters:
      name - the name (must be unique)
      eventType - the type of event subscribed
      eventListener - the consumer of the event (what will be done with it)
  • Method Details

    • match

      public boolean match(Event event)
      Return if an event matches the event type of the actual subscription
      Parameters:
      event - the type of event to test
      Returns:
      true if it matches
    • getListener

      public Consumer<E> getListener()
      Return the consumer of the event
      Returns:
      the consumer
    • getEventType

      public Class<E> getEventType()