Class NotificationEvent<TPayload extends NotificationEventPayload>

  • Type Parameters:
    TPayload - The type of the payload, which must extend `NotificationPayload`.
    All Implemented Interfaces:
    Serializable

    public final class NotificationEvent<TPayload extends NotificationEventPayload>
    extends Object
    implements Serializable
    Represents a notification event with a payload of type `TPayload`.
    See Also:
    Serialized Form
    • Constructor Detail

      • NotificationEvent

        public NotificationEvent​(NotificationEventType eventType,
                                 TPayload payload)
        Creates a new NotificationEvent instance.
        Parameters:
        eventType - The event type
        payload - The payload of the event, can be null.
    • Method Detail

      • getPayload

        public Optional<TPayload> getPayload()
        Gets the payload of the event, if present.
        Returns:
        An `Optional` containing the payload, or an empty `Optional` if no payload is present.
      • getCreationTime

        public Instant getCreationTime()
        The timestamp when the event was created.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object