Class NotificationRepresentation
java.lang.Object
com.reallifedeveloper.common.resource.notification.NotificationRepresentation
A REST-ful representation of a
Notification
.- Author:
- RealLifeDeveloper
-
Constructor Summary
ConstructorsConstructorDescriptionNotificationRepresentation
(Notification notification, ObjectSerializer<String> objectSerializer) Creates a newNotificationRepresentation
representing the givenNotification
, and using the givenObjectSerializer
to serialize the domain event. -
Method Summary
Modifier and TypeMethodDescription@Nullable String
getEvent()
Gives the serialized form of the domain event.@Nullable String
Gives the name of the domain event class.@Nullable ZonedDateTime
Gives the date and time the domain event occurred.long
Gives the ID of the stored event represented by the notification.
-
Constructor Details
-
NotificationRepresentation
public NotificationRepresentation(Notification notification, ObjectSerializer<String> objectSerializer) Creates a newNotificationRepresentation
representing the givenNotification
, and using the givenObjectSerializer
to serialize the domain event.- Parameters:
notification
- the notification to representobjectSerializer
- the object serializer to use to serialize the domain event
-
-
Method Details
-
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
Gives the date and time the domain event occurred.- Returns:
- the date and time the domain event occurred
-
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 thisNotificationRepresentation
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
-