Interface HippoEventListener


  • public interface HippoEventListener
    Developers can implement this HippoEventListener interface and implement onEvent(HippoEvent) to get a callback whenever a HippoEvent is posted to the HippoEventBus by HippoEventBus.post(Object)

    Note that this is a convenience interface; it is not necessary to use, as any method that is annotated with the Subscribe annotation having a HippoEvent argument type, will be invoked.

    Example code:

    
         HippoEventListenerRegistry.get().register(new HippoEventListener() {
             // implement the onEvent method
             // Note that the method with the annotation MUST be public
             public void onEvent(HippoEvent<?> event) {
                 System.out.println(event);
         }
    
         // get the eventBus
         HippoEventBus eventBus = HippoServiceRegistry.getService(HippoEventBus.class);
         // post an event which subsequently will be printed by the listener defined above
         eventBus.post(new HippoEvent("foo").message("bar"));
     });