Class EventBusSubscriptionDefinition<E extends Event>

  • 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
    This defintion defines a subscripter in the eventbus pattern. A endpoint is : - a type of event - a way to consume the event.
    Author:
    pchretien
    • Constructor Detail

      • 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 Detail

      • 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()