Interface NotificationBuilder
- All Known Implementing Classes:
StandardNotificationBuilder
public interface NotificationBuilder
Builds instances of
Notification based on input parameters. Instances of NotificationBuilder may
be configured partially by the container, therefore they should be created using a Provider or
Injected into client code.
In general a new instance of NotificationBuilder should be obtained for each use as they should not be
considered thread-safe. Likewise, they should not be bound in the container as Singleton types
and should be created on-demand.
Typically instances of this interface will throw NotificationConfigurationException in the event
notifications are not configured properly, such as missing the correct ApplicationConfiguration assocaited
with the requesting Application.-
Method Summary
Modifier and TypeMethodDescriptionAdds a single key/value property.Adds all properties in the passed in mapping to the notification being built.application(Application application) Specifies theApplicationsourcing theNotification.build()Constructs the instance ofNotificationwith all of the configured information.Specifies the text to send along with theNotification.Specifies theProfilewhich will receive theNotification.default NotificationBuilderSpecifies the profile which is sending the notification.default NotificationBuildersound()Specifies the default sound to play when sending a message.Specifies the sound to play when delivering the message.Specifies the title text of theNotification.
-
Method Details
-
sender
Specifies the profile which is sending the notification. The default implementation of this should just defaults to using theProfile.getApplication()and supplying it directly toApplication. Implementations may include more detailed information about the sender of theNotification- Parameters:
sourceProfile- theProfileof the source of theNotification- Returns:
- this instance
-
application
Specifies theApplicationsourcing theNotification. This will scan the associatedApplicationConfigurationinstances and select a suitable configuration (or combination thereof) which will be used to configure the means by which the underlyingNotificationwill be sent.- Parameters:
application- theApplicationsending theNotification- Returns:
- this instance
-
recipient
Specifies theProfilewhich will receive theNotification.- Parameters:
recipient- theProfilewhich will recieve theNotification- Returns:
- this instance
-
title
Specifies the title text of theNotification.- Parameters:
title- the title text- Returns:
- this instance
-
message
Specifies the text to send along with theNotification.- Parameters:
message- the message to send- Returns:
- this instance
-
sound
Specifies the default sound to play when sending a message. The default implementation just specifies the sound using "default." passed tosound(String).- Returns:
- this instance
-
sound
Specifies the sound to play when delivering the message.- Parameters:
sound- the sound to play when delivering the message- Returns:
- this instance
-
add
Adds a single key/value property. Individual keys should be non-empty and all values should be non-null- Parameters:
key- - A non-empty string key for the propertyvalue- - A non-null string value for the property- Returns:
- this instance
-
addAll
Adds all properties in the passed in mapping to the notification being built. Any keys which are null or empty Strings will be ignored. Any values which are null will be ignored. For all other entries, if any keys previously exist in the notification, they will be replaced by the value specified in the passed in Map. If a value is null, then that- Parameters:
properties- - A Map of all properties to be added in bulk to this notification.- Returns:
- this instance
-
build
Notification build()Constructs the instance ofNotificationwith all of the configured information. This returns a new instance ofNotificationfor each call which can be treated independently.- Returns:
- the
Notification
-