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 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 the StoredEvent that the Notification 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

      Optional<Integer> eventIntValue(String fieldName)
      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

      Optional<Long> eventLongValue(String fieldName)
      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

      Optional<Double> eventDoubleValue(String fieldName)
      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

      Optional<String> eventStringValue(String fieldName)
      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

      Optional<ZonedDateTime> zonedDateTimeValue(String fieldName)
      Gives the value of a field in the domain event as a java.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