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:

    public class Foo {
        @Subscribe
        void doSomethingWith(Bar payload) {
            // ...
        }
    }
    
    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.

    The abstract event message helps in strong-typing EventBus-accepted functions and encapsulates a default payload that is requestable by using the getPayload method.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final T payload
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      T getPayload()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait