public class Notification extends Object implements 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(String type)
Create a new
Notification of the given type. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getDefaultMessage()
Returns the default message to display for this notification.
|
String |
getFieldValue(String field)
Returns the value of a field.
|
String |
getType()
Returns the type of the notification
|
int |
hashCode() |
Notification |
setDefaultMessage(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(String field,
String value)
Adds a field (kind of property) to the notification
|
String |
toString() |
public Notification(String type)
Create a new Notification
of the given type.
Example: type = "new-violations"
type
- the type of notificationpublic Notification setDefaultMessage(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 String getDefaultMessage()
public Notification setFieldValue(String field, @Nullable String value)
field
- the name of the field (= the key)value
- the value of the field@CheckForNull public String getFieldValue(String field)
field
- the fieldCopyright © 2009–2017 SonarSource. All rights reserved.