Package org.somda.sdc.common.event
Class AbstractEventMessage
-
- All Implemented Interfaces:
-
org.somda.sdc.common.event.EventMessage
public abstract class AbstractEventMessage<T> implements EventMessage
Simple message container to ease use with com.google.common.eventbus.EventBus.
Google Guava's event bus library dispatches events based on function parametrization. Given a class with a com.google.common.eventbus.Subscribe annotation:
If an instance of Foo is registered for an event bus and post with a Bar instance is invoked, Guava knows which function to call by looking at the parameters of all Subsribe-annotated functions.public class Foo { @Subscribe void doSomethingWith(Bar payload) { // ... } }The abstract event message helps in strong-typing EventBus-accepted functions and encapsulates a default payload that is requestable by using the getPayload method.
-
-
Method Summary
Modifier and Type Method Description TgetPayload()-
-
Method Detail
-
getPayload
T getPayload()
-
-
-
-