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 newNotificationRepresentationrepresenting the givenNotification, and using the givenObjectSerializerto serialize the domain event. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetEvent()Gives the serialized form of the domain event.@Nullable StringGives the name of the domain event class.@Nullable ZonedDateTimeGives the date and time the domain event occurred.longGives the ID of the stored event represented by the notification.
-
Constructor Details
-
NotificationRepresentation
public NotificationRepresentation(Notification notification, ObjectSerializer<String> objectSerializer) Creates a newNotificationRepresentationrepresenting the givenNotification, and using the givenObjectSerializerto 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
ObjectSerializeris being used, and not on how thisNotificationRepresentationis 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
-