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 benullnullableNext- the ID of the next notification log, may benullnullablePrevious- the ID of the previous notification log, may benullnotifications- the list of notifications in this notification log, must not benullisArchived- iftrue, 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 Summary
ConstructorsConstructorDescriptionNotificationLog(NotificationLogId current, @Nullable NotificationLogId nullableNext, @Nullable NotificationLogId nullablePrevious, List<Notification> notifications, boolean isArchived) Creates a newNotificationLog. -
Method Summary
Modifier and TypeMethodDescriptioncurrent()Returns the value of thecurrentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisArchivedrecord component.next()Gives the ID of the next notification log as ajava.util.Optional.Returns the value of thenotificationsrecord component.@Nullable NotificationLogIdReturns the value of thenullableNextrecord component.@Nullable NotificationLogIdReturns the value of thenullablePreviousrecord component.previous()Gives the ID of the previous notification log as ajava.util.Optional.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
NotificationLog
public NotificationLog(NotificationLogId current, @Nullable NotificationLogId nullableNext, @Nullable NotificationLogId nullablePrevious, List<Notification> notifications, boolean isArchived) Creates a newNotificationLog.
-
-
Method Details
-
next
Gives the ID of the next notification log as ajava.util.Optional.- Returns:
- the ID of the next notification log
-
previous
Gives the ID of the previous notification log as ajava.util.Optional.- Returns:
- the ID of the previous notification log
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
current
Returns the value of thecurrentrecord component.- Returns:
- the value of the
currentrecord component
-
nullableNext
Returns the value of thenullableNextrecord component.- Returns:
- the value of the
nullableNextrecord component
-
nullablePrevious
Returns the value of thenullablePreviousrecord component.- Returns:
- the value of the
nullablePreviousrecord component
-
notifications
Returns the value of thenotificationsrecord component.- Returns:
- the value of the
notificationsrecord component
-
isArchived
public boolean isArchived()Returns the value of theisArchivedrecord component.- Returns:
- the value of the
isArchivedrecord component
-