Class NotificationLogId
java.lang.Object
com.reallifedeveloper.common.application.notification.NotificationLogId
The ID of a
NotificationLog
, representing an interval of Notifications
that can be held in the log.
The low and high properties of the NotificationLogId
refer to the IDs of the
StoredEvents
represented by the first and last
Notifications
, respectively.
For a NotificationLog
that has been archived, the low and high attributes of the ID exactly match the stored event IDs of the
first and last notifications. If the log has not yet been archived, it is not yet "full", so the high attribute may be greater than the
stored event ID of the last notification.
For example, an unarchived notification log which can hold 20 notifications may contain only 5 notifications, with stored event IDs 80
through 84. In this case, the NotificationLogId
would have a low property of 80 and a high property of 99.
- Author:
- RealLifeDeveloper
-
Constructor Summary
ConstructorsConstructorDescriptionNotificationLogId
(long low, long high) Creates a newNotificationLogId
with the given low and high properties.NotificationLogId
(String notificationLogId) Creates a newNotificationLogId
with the low and high properties parsed from a comma-separated string. -
Method Summary
Modifier and TypeMethodDescriptionint
Gives the batch size of theNotificationLog
with thisNotificationLogId
, i.e., the number ofNotifications
it can hold.Gives a standard string representation of thisNotificationLogId
, on the form "<low>,<high>".long
high()
Gives the high property of thisNotificationLogId
, i.e., the stored event ID of the last notification that may be stored in aNotificationLog
.long
low()
Gives the low property of thisNotificationLogId
, i.e., the stored event ID of the first notification that may be stored in aNotificationLog
.next()
Gives aNotificationLogId
representing the next batch of notifications, after the ones in the currentNotificationLog
.previous()
Gives aNotificationLogId
representing the previous batch of notifications, before the ones in the currentNotificationLog
.toString()
-
Constructor Details
-
NotificationLogId
public NotificationLogId(long low, long high) Creates a newNotificationLogId
with the given low and high properties.- Parameters:
low
- the stored event ID of the firstNotification
high
- the stored event ID of the lastNotification
- Throws:
IllegalArgumentException
- iflow
is greater thanhigh
-
NotificationLogId
Creates a newNotificationLogId
with the low and high properties parsed from a comma-separated string.- Parameters:
notificationLogId
- a string on the form "<low>,<high>"- Throws:
IllegalArgumentException
- if the string isnull
or has the wrong form
-
-
Method Details
-
externalForm
Gives a standard string representation of thisNotificationLogId
, on the form "<low>,<high>".- Returns:
- a standard string representation of this
NotificationLogId
-
low
public long low()Gives the low property of thisNotificationLogId
, i.e., the stored event ID of the first notification that may be stored in aNotificationLog
.- Returns:
- the low property of this
NotificationLogId
-
high
public long high()Gives the high property of thisNotificationLogId
, i.e., the stored event ID of the last notification that may be stored in aNotificationLog
.- Returns:
- the high property of this
NotificationLogId
-
next
Gives aNotificationLogId
representing the next batch of notifications, after the ones in the currentNotificationLog
.- Returns:
- a
NotificationLogId
representing the next batch of notifications
-
previous
Gives aNotificationLogId
representing the previous batch of notifications, before the ones in the currentNotificationLog
.- Returns:
- a
NotificationLogId
representing the previous batch of notifications
-
batchSize
public int batchSize()Gives the batch size of theNotificationLog
with thisNotificationLogId
, i.e., the number ofNotifications
it can hold.- Returns:
- the batch size
-
toString
-