Class AnnotatedEventHandler

  • All Implemented Interfaces:
    EventHandler

    public class AnnotatedEventHandler
    extends Object
    implements EventHandler
    Extending this class will allow you to colocate multiple related Event handling methods inside the same class and use it together with the LocalEventBus
    Each method must accept a single Event argument, return void and be annotated with the EventHandler annotation.
    The method argument type is matched against the concrete event type using Class.isAssignableFrom(Class).
    The method accessibility can be any combination of private, protected, public, etc.
    Example:
    {@code
     public class OrderEventsHandler extends AnnotatedEventHandler {
    • Constructor Detail

      • AnnotatedEventHandler

        public AnnotatedEventHandler​(Object invokeEventHandlerMethodsOn)
        Create an AnnotatedEventHandler that can resolve and invoke event handler methods, i.e. methods annotated with @Handler, on another object
        Parameters:
        invokeEventHandlerMethodsOn - the object that contains the @Handler annotated methods
      • AnnotatedEventHandler

        public AnnotatedEventHandler()
        Create an AnnotatedEventHandler that can resolve and invoke event handler methods, i.e. methods annotated with @Handler, on this concrete subclass of AnnotatedEventHandler