public class Notification
extends java.lang.Object
implements java.io.Serializable
NotificationChannel
).
When creating a new notification, it is strongly advised to give a default message that can be used by channels
that don't want to specifically format messages for different notification types. You can use
setDefaultMessage(String)
for that purpose.
Constructor and Description |
---|
Notification(java.lang.String type)
Create a new
Notification of the given type. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getDefaultMessage()
Returns the default message to display for this notification.
|
java.lang.String |
getFieldValue(java.lang.String field)
Returns the value of a field.
|
java.lang.String |
getType()
Returns the type of the notification
|
int |
hashCode() |
Notification |
setDefaultMessage(java.lang.String value)
When creating a new notification, it is strongly advised to give a default message that can be
used by channels that don't want to specifically format messages for different notification types.
|
Notification |
setFieldValue(java.lang.String field,
java.lang.String value)
Adds a field (kind of property) to the notification
|
java.lang.String |
toString() |
public Notification(java.lang.String type)
Create a new Notification
of the given type.
Example: type = "new-violations"
type
- the type of notificationpublic java.lang.String getType()
public Notification setDefaultMessage(java.lang.String value)
When creating a new notification, it is strongly advised to give a default message that can be used by channels that don't want to specifically format messages for different notification types.
This method is equivalent to setting a value for the field DEFAULT_MESSAGE_KEY
with
setFieldValue(String, String)
.
public java.lang.String getDefaultMessage()
public Notification setFieldValue(java.lang.String field, @Nullable java.lang.String value)
field
- the name of the field (= the key)value
- the value of the field@CheckForNull public java.lang.String getFieldValue(java.lang.String field)
field
- the fieldpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object