Interface NotificationReader
- All Known Implementing Classes:
GsonNotificationReader
public interface NotificationReader
A reader of serialized
Notifications
, that lets the user read information from the notification without having to
deserialize it to a Java object. This means that the notification can be used without having access to the class files for the domain
events in question.
This interface provides a number of methods to access fields in the the domain event that caused the notification to occur, e.g.,
eventIntValue(String)
. These methods take the field name as an argument. The field name can be simple, e.g., "foo", or nested,
e.g., "foo.bar". A nested field name refers to a similarly nested object in the domain event.
For example, if the method eventIntValue(String)
is called with the field name "foo.bar", the domain event should contain an
object named "foo" which contains an integer field named "bar".
- Author:
- RealLifeDeveloper
-
Method Summary
Modifier and TypeMethodDescriptioneventDoubleValue
(String fieldName) Gives the double value of a field in the domain event.eventIntValue
(String fieldName) Gives the integer value of a field in the domain event.eventLongValue
(String fieldName) Gives the long integer value of a field in the domain event.eventStringValue
(String fieldName) Gives the string value of a field in the domain event.Gives the name of the domain event class.Gives the version of the domain event.Gives the date and time when the domain event occurred.Gives the ID of theStoredEvent
that theNotification
is based on.zonedDateTimeValue
(String fieldName) Gives the value of a field in the domain event as ajava.time.ZonedDateTime
object.
-
Method Details
-
eventType
String eventType()Gives the name of the domain event class.- Returns:
- the name of the domain event class
-
storedEventId
Long storedEventId()Gives the ID of theStoredEvent
that theNotification
is based on.- Returns:
- the ID of the
StoredEvent
-
occurredOn
ZonedDateTime occurredOn()Gives the date and time when the domain event occurred.- Returns:
- the date and time the domain event occurred
-
eventVersion
Integer eventVersion()Gives the version of the domain event.- Returns:
- the version of the domain event
-
eventIntValue
Gives the integer value of a field in the domain event.- Parameters:
fieldName
- the name of the field to lookup, potentially nested, e.g., "foo.bar"- Returns:
- the optoinl integer value of the field
-
eventLongValue
Gives the long integer value of a field in the domain event.- Parameters:
fieldName
- the name of the field to lookup, potentially nested, e.g., "foo.bar"- Returns:
- the optional long integer value of the field
-
eventDoubleValue
Gives the double value of a field in the domain event.- Parameters:
fieldName
- the name of the field to lookup, potentially nested, e.g., "foo.bar"- Returns:
- the optional double value of the field
-
eventStringValue
Gives the string value of a field in the domain event.- Parameters:
fieldName
- the name of the field to lookup, potentially nested, e.g., "foo.bar"- Returns:
- the optional string value of the field
-
zonedDateTimeValue
Gives the value of a field in the domain event as ajava.time.ZonedDateTime
object.- Parameters:
fieldName
- the name of the field to lookup, potentially nested, e.g., "foo.bar"- Returns:
- the optional
java.time.ZonedDateTime
value of the field
-