public abstract class AbstractNotification extends Object implements Notification
Notification that takes care of
everything but creating the text of the notification, so only
Notification.render(java.io.Writer) needs to be override by
subclasses.CREATED_TIME_SORTER, LAST_UPDATED_TIME_SORTER| Constructor and Description |
|---|
AbstractNotification()
Creates a new notification with a random ID, the current time as creation
and last udpate time and is dismissable by the user.
|
AbstractNotification(String id)
Creates a new notification with the current time as creation and last
udpate time and is dismissable by the user.
|
AbstractNotification(String id,
long createdTime)
Creates a new notification with the given time as creation and last
update time and is dismissable by the user.
|
AbstractNotification(String id,
long createdTime,
long lastUpdatedTime)
Creates a new notification with the given creation and last update time
and is dismissable by the user.
|
AbstractNotification(String id,
long createdTime,
long lastUpdatedTime,
boolean dismissable)
Creates a new notification.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNotificationListener(NotificationListener notificationListener)
Adds the given notification listener.
|
void |
dismiss()
Dismisses this notification.
|
boolean |
equals(Object object) |
long |
getCreatedTime()
Returns the time when this notifiation was created.
|
String |
getId()
Returns the unique ID of this notification.
|
long |
getLastUpdatedTime()
Returns the time when this notifiation was last updated.
|
int |
hashCode() |
boolean |
isDismissable()
Returns whether this notification may be dismissed by the user.
|
void |
removeNotificationListener(NotificationListener notificationListener)
Removes the given notification listener.
|
void |
setDismissable(boolean dismissable)
Sets whether this notification is dismissable.
|
void |
setLastUpdateTime(long lastUpdateTime)
Sets the last updated time.
|
protected void |
touch()
Updates the
last update time to the current
time. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitrenderpublic AbstractNotification()
public AbstractNotification(String id)
id - The ID of the notificationpublic AbstractNotification(String id, long createdTime)
id - The ID of the notificationcreatedTime - The time when this notification was createdpublic AbstractNotification(String id, long createdTime, long lastUpdatedTime)
id - The ID of the notificationcreatedTime - The time when this notification was createdlastUpdatedTime - The time when this notification was last udpatedpublic AbstractNotification(String id, long createdTime, long lastUpdatedTime, boolean dismissable)
id - The ID of the notificationcreatedTime - The time when this notification was createdlastUpdatedTime - The time when this notification was last udpateddismissable - true if this notification is dismissable by the userpublic void addNotificationListener(NotificationListener notificationListener)
addNotificationListener in interface NotificationnotificationListener - The listener to addpublic void removeNotificationListener(NotificationListener notificationListener)
removeNotificationListener in interface NotificationnotificationListener - The listener to removepublic String getId()
getId in interface Notificationpublic long getCreatedTime()
getCreatedTime in interface Notificationpublic long getLastUpdatedTime()
getLastUpdatedTime in interface Notificationpublic void setLastUpdateTime(long lastUpdateTime)
lastUpdateTime - The time this notification was last updatedpublic boolean isDismissable()
isDismissable in interface Notificationtrue if this notification is dismissable by the user,
false otherwisepublic void setDismissable(boolean dismissable)
dismissable - true if this notification is dismissablepublic void dismiss()
dismiss in interface Notificationprotected void touch()
last update time to the current
time.Copyright © 2026. All rights reserved.