Class Event

  • All Implemented Interfaces:
    java.io.Serializable

    public class Event
    extends java.util.EventObject
    This is the default event class used by this package. Each event has a unique event identifier (a String), a severity indicator, a locale (for formatting event messages), and a map of name/value pairs.
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Event.ParamsBuilder
      This class is a fluent builder class for building up the parameter map.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String eventGroupID  
      private java.lang.String eventKey  
      private java.util.Locale locale  
      private java.util.Map<java.lang.String,​java.lang.Object> params  
      private static long serialVersionUID  
      private EventSeverity severity  
      • Fields inherited from class java.util.EventObject

        source
    • Constructor Summary

      Constructors 
      Constructor Description
      Event​(java.lang.Object source, java.lang.String eventID, EventSeverity severity, java.util.Locale locale, java.util.Map<java.lang.String,​java.lang.Object> params)
      Creates a new Event.
      Event​(java.lang.Object source, java.lang.String eventID, EventSeverity severity, java.util.Map<java.lang.String,​java.lang.Object> params)
      Creates a new Event using default locale.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getEventGroupID()
      Returns the event group identifier.
      java.lang.String getEventID()
      Returns the event identifier.
      java.lang.String getEventKey()
      Returns the event key.
      java.util.Locale getLocale()
      Returns the locale.
      java.lang.Object getParam​(java.lang.String key)
      Returns a parameter.
      java.util.Map<java.lang.String,​java.lang.Object> getParams()
      Returns an unmodifiable Map with all event parameters.
      EventSeverity getSeverity()
      Returns the severity level.
      static Event.ParamsBuilder paramsBuilder()
      Creates and returns a fluent builder object for building up the parameter map.
      void setSeverity​(EventSeverity severity)
      Sets the event's severity level.
      • Methods inherited from class java.util.EventObject

        getSource, toString
      • Methods inherited from class java.lang.Object

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

      • eventGroupID

        private java.lang.String eventGroupID
      • eventKey

        private java.lang.String eventKey
      • locale

        private java.util.Locale locale
      • params

        private java.util.Map<java.lang.String,​java.lang.Object> params
    • Constructor Detail

      • Event

        public Event​(java.lang.Object source,
                     java.lang.String eventID,
                     EventSeverity severity,
                     java.util.Map<java.lang.String,​java.lang.Object> params)
        Creates a new Event using default locale.
        Parameters:
        source - the object that creates the event
        eventID - the unique identifier of the event
        severity - the severity level
        params - the event parameters (a map of name/value pairs)
      • Event

        public Event​(java.lang.Object source,
                     java.lang.String eventID,
                     EventSeverity severity,
                     java.util.Locale locale,
                     java.util.Map<java.lang.String,​java.lang.Object> params)
        Creates a new Event.
        Parameters:
        source - the object that creates the event
        eventID - the unique identifier of the event
        severity - the severity level
        locale - to use when formatting event (or null, which means use default locale)
        params - the event parameters (a map of name/value pairs)
    • Method Detail

      • getEventID

        public java.lang.String getEventID()
        Returns the event identifier.
        Returns:
        the event identifier
      • getEventGroupID

        public java.lang.String getEventGroupID()
        Returns the event group identifier.
        Returns:
        the event group identifier (or null if there is no group identifier)
      • getEventKey

        public java.lang.String getEventKey()
        Returns the event key.
        Returns:
        the event key
      • getSeverity

        public EventSeverity getSeverity()
        Returns the severity level.
        Returns:
        the severity level
      • setSeverity

        public void setSeverity​(EventSeverity severity)
        Sets the event's severity level. This method can be used to increase or decrease the severity level in a listener.
        Parameters:
        severity - the new event severity
      • getLocale

        public java.util.Locale getLocale()
        Returns the locale.
        Returns:
        the locale
      • getParam

        public java.lang.Object getParam​(java.lang.String key)
        Returns a parameter.
        Parameters:
        key - the key to the parameter
        Returns:
        the parameter value or null if no value with this key is found
      • getParams

        public java.util.Map<java.lang.String,​java.lang.Object> getParams()
        Returns an unmodifiable Map with all event parameters.
        Returns:
        the parameter map
      • paramsBuilder

        public static Event.ParamsBuilder paramsBuilder()
        Creates and returns a fluent builder object for building up the parameter map.
        Returns:
        the parameter builder