Interface ListenerInvoker


public interface ListenerInvoker
Implementation of this interface know how to invoke 'given types' of listeners so that they handle given events.

Note: Implementations MUST provide correct implementations of the Object.equals(Object) and Object.hashCode() method.

Since:
2.0
  • Method Details

    • getSupportedEventTypes

      Set<Class<?>> getSupportedEventTypes()
      The types of events supported by this invoker. I.e. invoke(Object) can be safely called with any object that is an instance of at least one of those types.
      Returns:
      the set of supported event types.
    • invoke

      void invoke(Object event)
      Invokes the underlying listener for the given event.
      Parameters:
      event - the event to tell the listener about.
      Throws:
      IllegalArgumentException - if the event is not an instance of any of the types returned by getSupportedEventTypes()
    • supportAsynchronousEvents

      boolean supportAsynchronousEvents()
      Whether or not the underlying listener can handle asynchronous event.
      Returns:
      true if the underlying listener can handle asynchronous events, false otherwise
    • getScope

      default Optional<String> getScope()
    • getOrder

      default int getOrder()
      See EventPublisher.publish(Object) for details on processing event order.
      Returns:
      int used for ordering event listeners