Annotation Interface EventListener


@Target(METHOD) @Retention(RUNTIME) public @interface EventListener
Annotation used to mark methods that act as subscribers for system events.

Annotated methods must fulfill the following structural requirements:

  • Must be public and non-static.
  • Must accept exactly one parameter that extends the Event class.

The execution order of multiple listeners subscribed to the same event type is governed by the defined EventPriority.

See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Defines the execution priority of the annotated event listener.
  • Element Details

    • priority

      EventPriority priority
      Defines the execution priority of the annotated event listener.

      Listeners with higher priority values are invoked first by the EventHandler.

      Returns:
      the execution priority of this listener, defaults to EventPriority.NORMAL
      Default:
      NORMAL