Class AbstractEvent

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​java.lang.Object> data  
      protected java.lang.String origin  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractEvent​(java.lang.String origin)
      Construct a new AbstractEvent
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getData​(java.lang.String key)
      Retrieve a data value from this event, given a named key
      java.lang.String getOrigin()
      Getter for the Event's origin.
      AbstractEvent withData​(java.lang.String key, java.lang.Object data)
      Add a data item to this event with the given name and value
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • origin

        protected final java.lang.String origin
      • data

        protected final java.util.Map<java.lang.String,​java.lang.Object> data
    • Constructor Detail

      • AbstractEvent

        public AbstractEvent​(java.lang.String origin)
        Construct a new AbstractEvent
        Parameters:
        origin - a string indicating the origin of the Event such as 'Concurrency'. Designed to agree with the DiSCo support package names, and may be used for logging or decision making in Listeners.
    • Method Detail

      • withData

        public AbstractEvent withData​(java.lang.String key,
                                      java.lang.Object data)
        Add a data item to this event with the given name and value
        Parameters:
        key - the name of this data
        data - the value of this data
        Returns:
        the 'this' of the Event, to allow method chaining
      • getOrigin

        public java.lang.String getOrigin()
        Getter for the Event's origin. This is named for the DiSCo support package name e.g. 'Web'
        Specified by:
        getOrigin in interface Event
        Returns:
        the origin of this event
      • getData

        public java.lang.Object getData​(java.lang.String key)
        Retrieve a data value from this event, given a named key
        Specified by:
        getData in interface Event
        Parameters:
        key - the name of the data to retrieve
        Returns:
        the value of the data, or null if absent