public interface HippoEventListener
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"));
});
Modifier and Type | Method and Description |
---|---|
void |
onEvent(org.onehippo.cms7.event.HippoEvent<?> event) |
Copyright © 2012–2019 Hippo B.V. (http://www.onehippo.com). All rights reserved.