public class NotificationResponse
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
static NotificationResponse |
EMPTY_RESPONSE
Useful for returning an empty set of notices.
|
| Constructor and Description |
|---|
NotificationResponse() |
NotificationResponse(java.util.List<NotificationCategory> categories,
java.util.List<NotificationError> errors) |
NotificationResponse(NotificationResponse response) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.Object |
clone()
Implements deep-copy clone.
|
NotificationResponse |
cloneIfNotCloned()
Best guess as to the reason this method exists: beans that produce fresh
NotificationResponse objects (without cloning them) may safely cache them. |
NotificationResponse |
combine(NotificationResponse response)
Combine the contents of this response with the provided response and
return a new instance of
NotificationResponse. |
NotificationResponse |
filter(java.util.function.Predicate<NotificationEntry> predicate)
Return a new instance of
NotificationResponse containing only
NotificationEntry objects within this response that match the specified
Predicate. |
NotificationResponse |
filterErrors(java.util.Set<java.lang.Integer> hiddenErrorKeys)
Return a new instance of
NotificationResponse from which
the specified errors have been removed. |
NotificationEntry |
findNotificationEntryById(java.lang.String notificationId)
Returns the
NotificationEntry with the specified id, or null if
not present. |
java.util.List<NotificationCategory> |
getCategories() |
java.util.List<NotificationError> |
getErrors() |
void |
setCategories(java.util.List<NotificationCategory> categories) |
void |
setErrors(java.util.List<NotificationError> errors) |
int |
size()
Provides the total number of notifications contained in the response.
|
java.lang.String |
toString() |
public static final NotificationResponse EMPTY_RESPONSE
public NotificationResponse()
public NotificationResponse(NotificationResponse response)
public NotificationResponse(java.util.List<NotificationCategory> categories, java.util.List<NotificationError> errors)
public java.util.List<NotificationCategory> getCategories()
public void setCategories(java.util.List<NotificationCategory> categories)
public java.util.List<NotificationError> getErrors()
public void setErrors(java.util.List<NotificationError> errors)
public NotificationEntry findNotificationEntryById(java.lang.String notificationId)
NotificationEntry with the specified id, or null if
not present.public NotificationResponse combine(NotificationResponse response)
NotificationResponse. The
original instances are unchanged.response - A new NotificationResponse that contains data from both originalspublic NotificationResponse filterErrors(java.util.Set<java.lang.Integer> hiddenErrorKeys)
NotificationResponse from which
the specified errors have been removed. The original instances are
unchanged.hiddenErrorKeys - set of error keys to exclude from resultpublic NotificationResponse filter(java.util.function.Predicate<NotificationEntry> predicate)
NotificationResponse containing only
NotificationEntry objects within this response that match the specified
Predicate. The category structure is preserved. Empty categories are removed.public int size()
public java.lang.String toString()
toString in class java.lang.Objectprotected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - Not really, but it's on the method
signature we're overriding.public NotificationResponse cloneIfNotCloned()
NotificationResponse objects (without cloning them) may safely cache them. They need
not fear that another bean will transform their copy. Beans that do clone them, however, can
safely operate on a clone.