Class Event


  • public abstract class Event
    extends java.lang.Object
    An Event that can be fired.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Event.Severity
      All supported event severities.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Event NONE
      Empty no-op Event.
    • Constructor Summary

      Constructors 
      Constructor Description
      Event()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void destroy()
      Clean up when destroyed.
      void fire​(java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.Object>> data)
      Fire an event, when enabled, using the lazily supplied data.
      abstract void fire​(java.util.Map<java.lang.String,​java.lang.Object> data)
      Fire an event with the given structured data.
      void fireLimited​(java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.Object>> data)
      Fire an event, when enabled, using the lazily supplied data.
      void fireLimited​(java.util.Map<java.lang.String,​java.lang.Object> data)
      Fire an event with the given structured data.
      abstract boolean isEnabled()
      Whether this event is enabled for firing.
      • Methods inherited from class java.lang.Object

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

      • NONE

        public static final Event NONE
        Empty no-op Event.
    • Constructor Detail

      • Event

        public Event()
    • Method Detail

      • isEnabled

        public abstract boolean isEnabled()
        Whether this event is enabled for firing.
        Returns:
        whether this event is enabled
      • fire

        public abstract void fire​(java.util.Map<java.lang.String,​java.lang.Object> data)
        Fire an event with the given structured data.
        Parameters:
        data - structured event data
      • destroy

        public abstract void destroy()
        Clean up when destroyed.
      • fire

        public void fire​(java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.Object>> data)
        Fire an event, when enabled, using the lazily supplied data.
        Parameters:
        data - supplier of data, only accessed if event is enabled
      • fireLimited

        public void fireLimited​(java.util.Map<java.lang.String,​java.lang.Object> data)
        Fire an event with the given structured data.

        This can be used by events to be notified of rate limited triggers as well, to do things like counting the total number of times being fired, even if some are not sent off to the receiver.

        Parameters:
        data - structured event data
      • fireLimited

        public void fireLimited​(java.util.function.Supplier<java.util.Map<java.lang.String,​java.lang.Object>> data)
        Fire an event, when enabled, using the lazily supplied data.

        This can be used by events to be notified of rate limited triggers as well, to do things like counting the total number of times being fired, even if some are not sent off to the receiver.

        Parameters:
        data - supplier of data, only accessed if event is enabled