Interface Event<T>

Type Parameters:
T - The event type

public interface Event<T>
Represents a Server Sent Event. See https://www.w3.org/TR/2011/WD-eventsource-20111020/.
Since:
1.0
Author:
Graeme Rocher
  • Field Details

  • Method Details

    • getData

      T getData()
      Returns:
      The data object to write
    • getId

      String getId()
      Returns:
      The ID of the event, or null if there is no ID
    • getName

      String getName()
      Returns:
      The name of the event
    • getComment

      String getComment()
      Returns:
      A comment for the event, or null if there is no comment
    • getRetry

      Duration getRetry()
      Returns:
      The duration to retry
    • retry

      Event<T> retry(@Nullable @Nullable Duration duration)
      Sets the retry duration.
      Parameters:
      duration - The duration
      Returns:
      The event
    • id

      Sets the id.
      Parameters:
      id - The id to set
      Returns:
      The event
    • name

      Sets the event name.
      Parameters:
      name - The event name
      Returns:
      The event
    • comment

      Event<T> comment(@Nullable @Nullable String comment)
      Sets the event comment.
      Parameters:
      comment - The Event comment
      Returns:
      The event
    • of

      static <ET> Event<ET> of(ET data)
      Constructs a new event for the given data.
      Type Parameters:
      ET - The data type
      Parameters:
      data - The data
      Returns:
      The event instance
    • of

      static <ET> Event<ET> of(Event event, ET data)
      Constructs a new event for the given data.
      Type Parameters:
      ET - The data type
      Parameters:
      event - The event
      data - The data
      Returns:
      The event instance