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 benull
nullableNext
- the ID of the next notification log, may benull
nullablePrevious
- the ID of the previous notification log, may benull
notifications
- the list of notifications in this notification log, must not benull
isArchived
- 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 thecurrent
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.boolean
Returns the value of theisArchived
record component.next()
Gives the ID of the next notification log as ajava.util.Optional
.Returns the value of thenotifications
record component.@Nullable NotificationLogId
Returns the value of thenullableNext
record component.@Nullable NotificationLogId
Returns the value of thenullablePrevious
record component.previous()
Gives the ID of the previous notification log as ajava.util.Optional
.final String
toString()
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 thecurrent
record component.- Returns:
- the value of the
current
record component
-
nullableNext
Returns the value of thenullableNext
record component.- Returns:
- the value of the
nullableNext
record component
-
nullablePrevious
Returns the value of thenullablePrevious
record component.- Returns:
- the value of the
nullablePrevious
record component
-
notifications
Returns the value of thenotifications
record component.- Returns:
- the value of the
notifications
record component
-
isArchived
public boolean isArchived()Returns the value of theisArchived
record component.- Returns:
- the value of the
isArchived
record component
-