Class AnnotatedEventHandler
- java.lang.Object
-
- dk.cloudcreate.essentials.reactive.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 theLocalEventBus
Each method must accept a single Event argument, return void and be annotated with theEventHandlerannotation.
The method argument type is matched against the concrete event type usingClass.isAssignableFrom(Class).
The method accessibility can be any combination of private, protected, public, etc.
Example:
{@code public class OrderEventsHandler extends AnnotatedEventHandler {
-
-
Constructor Summary
Constructors Constructor Description AnnotatedEventHandler()Create anAnnotatedEventHandlerthat can resolve and invoke event handler methods, i.e.AnnotatedEventHandler(Object invokeEventHandlerMethodsOn)Create anAnnotatedEventHandlerthat can resolve and invoke event handler methods, i.e.
-
-
-
Constructor Detail
-
AnnotatedEventHandler
public AnnotatedEventHandler(Object invokeEventHandlerMethodsOn)
Create anAnnotatedEventHandlerthat 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 anAnnotatedEventHandlerthat can resolve and invoke event handler methods, i.e. methods annotated with @Handler, on this concrete subclass ofAnnotatedEventHandler
-
-
Method Detail
-
handle
public final void handle(Object event)
- Specified by:
handlein interfaceEventHandler
-
-