Class NotificationRepresentation

java.lang.Object
com.reallifedeveloper.common.resource.notification.NotificationRepresentation

public final class NotificationRepresentation extends Object
A REST-ful representation of a Notification.
Author:
RealLifeDeveloper
  • Constructor Details

    • NotificationRepresentation

      public NotificationRepresentation(Notification notification, ObjectSerializer<String> objectSerializer)
      Creates a new NotificationRepresentation representing the given Notification, and using the given ObjectSerializer to serialize the domain event.
      Parameters:
      notification - the notification to represent
      objectSerializer - the object serializer to use to serialize the domain event
  • Method Details

    • getEventType

      public @Nullable String getEventType()
      Gives the name of the domain event class.
      Returns:
      the name of the domain event class
    • getStoredEventId

      public long getStoredEventId()
      Gives the ID of the stored event represented by the notification.
      Returns:
      the ID of the stored event represented by the notification
    • getOccurredOn

      public @Nullable ZonedDateTime getOccurredOn()
      Gives the date and time the domain event occurred.
      Returns:
      the date and time the domain event occurred
    • getEvent

      public @Nullable String getEvent()
      Gives the serialized form of the domain event.

      Note that this form depends only on which ObjectSerializer is being used, and not on how this NotificationRepresentation is serialized. For example, if a JSON object serializer is used, the event will be serialized as a JSON string, even if the representation is serialized as XML.

      Returns:
      the serialized form of the domain event