Record Class NotificationLog

java.lang.Object
java.lang.Record
com.reallifedeveloper.common.application.notification.NotificationLog
Record Components:
current - the ID of the current notification log, must not be null
nullableNext - the ID of the next notification log, may be null
nullablePrevious - the ID of the previous notification log, may be null
notifications - the list of notifications in this notification log, must not be null
isArchived - if true, this notification log is archived, i.e., it will never change

public record NotificationLog(NotificationLogId current, @Nullable NotificationLogId nullableNext, @Nullable NotificationLogId nullablePrevious, List<Notification> notifications, boolean isArchived) extends Record
A notification log holds a list of Notifications, i.e., information about domain events that have occurred and have been stored in an EventStore.

A notification log may be archived, which means that it will never change. If a log is archived, it means that the ID of the log will always refer to the current list of Notifications. If it is not archived, the only change that may occur is that more notifications are added to it; the notifications themselves represent historical events that have already occurred, so they are immutable.

Author:
RealLifeDeveloper
  • Constructor Details

  • Method Details

    • next

      public Optional<NotificationLogId> next()
      Gives the ID of the next notification log as a java.util.Optional.
      Returns:
      the ID of the next notification log
    • previous

      public Optional<NotificationLogId> previous()
      Gives the ID of the previous notification log as a java.util.Optional.
      Returns:
      the ID of the previous notification log
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • current

      public NotificationLogId current()
      Returns the value of the current record component.
      Returns:
      the value of the current record component
    • nullableNext

      public @Nullable NotificationLogId nullableNext()
      Returns the value of the nullableNext record component.
      Returns:
      the value of the nullableNext record component
    • nullablePrevious

      public @Nullable NotificationLogId nullablePrevious()
      Returns the value of the nullablePrevious record component.
      Returns:
      the value of the nullablePrevious record component
    • notifications

      public List<Notification> notifications()
      Returns the value of the notifications record component.
      Returns:
      the value of the notifications record component
    • isArchived

      public boolean isArchived()
      Returns the value of the isArchived record component.
      Returns:
      the value of the isArchived record component