Class Event

java.lang.Object
com.pnfsoftware.jeb.util.events.Event
All Implemented Interfaces:
IEvent

public class Event extends Object implements IEvent
Simple implementation of an event.
  • Field Details

  • Constructor Details

    • Event

      public Event()
      Create an event with type 0 and no data.
    • Event

      public Event(int type)
      Create an event with no data.
      Parameters:
      type - event type
    • Event

      public Event(int type, Object data)
      Create an event.
      Parameters:
      type - event type
      data - optional event payload
    • Event

      public Event(int type, Object data, EventSource source)
      Create an event with an explicit source.
      Parameters:
      type - event type
      data - optional event payload
      source - event source
  • Method Details

    • getSource

      public IEventSource getSource()
      Get the source that emitted this event.
      Specified by:
      getSource in interface IEvent
      Returns:
      the event source, or null if it has not been assigned
    • getType

      public Integer getType()
      Get the event type.
      Specified by:
      getType in interface IEvent
      Returns:
      the event type
    • getData

      public Object getData()
      Get the event payload.
      Specified by:
      getData in interface IEvent
      Returns:
      the event payload, or null if none was provided
    • getTimestamp

      public long getTimestamp()
      Get the event creation timestamp.
      Specified by:
      getTimestamp in interface IEvent
      Returns:
      epoch-relative timestamp in milliseconds
    • shouldStopPropagation

      public boolean shouldStopPropagation()
      Determine whether propagation should stop.
      Specified by:
      shouldStopPropagation in interface IEvent
      Returns:
      true if the event should not be propagated to additional listeners