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 newNotificationLogIdwith the given low and high properties.NotificationLogId(String notificationLogId) Creates a newNotificationLogIdwith the low and high properties parsed from a comma-separated string. -
Method Summary
Modifier and TypeMethodDescriptionintGives the batch size of theNotificationLogwith thisNotificationLogId, i.e., the number ofNotificationsit can hold.Gives a standard string representation of thisNotificationLogId, on the form "<low>,<high>".longhigh()Gives the high property of thisNotificationLogId, i.e., the stored event ID of the last notification that may be stored in aNotificationLog.longlow()Gives the low property of thisNotificationLogId, i.e., the stored event ID of the first notification that may be stored in aNotificationLog.next()Gives aNotificationLogIdrepresenting the next batch of notifications, after the ones in the currentNotificationLog.previous()Gives aNotificationLogIdrepresenting the previous batch of notifications, before the ones in the currentNotificationLog.toString()
-
Constructor Details
-
NotificationLogId
public NotificationLogId(long low, long high) Creates a newNotificationLogIdwith the given low and high properties.- Parameters:
low- the stored event ID of the firstNotificationhigh- the stored event ID of the lastNotification- Throws:
IllegalArgumentException- iflowis greater thanhigh
-
NotificationLogId
Creates a newNotificationLogIdwith 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 isnullor 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 aNotificationLogIdrepresenting the next batch of notifications, after the ones in the currentNotificationLog.- Returns:
- a
NotificationLogIdrepresenting the next batch of notifications
-
previous
Gives aNotificationLogIdrepresenting the previous batch of notifications, before the ones in the currentNotificationLog.- Returns:
- a
NotificationLogIdrepresenting the previous batch of notifications
-
batchSize
public int batchSize()Gives the batch size of theNotificationLogwith thisNotificationLogId, i.e., the number ofNotificationsit can hold.- Returns:
- the batch size
-
toString
-