Interface HippoEventListener
-
public interface HippoEventListener
Developers can implement thisHippoEventListener
interface and implementonEvent(HippoEvent)
to get a callback whenever aHippoEvent
is posted to theHippoEventBus
byHippoEventBus.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")); });
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
onEvent(HippoEvent<?> event)
-
-
-
Method Detail
-
onEvent
void onEvent(HippoEvent<?> event)
- Parameters:
event
- theHippoEvent
-
-