public class NotificationCenter
extends java.lang.Object
NotificationManager instances.
If a notification object is sent via send(Object) that is not supported
an OptimizelyRuntimeException will be thrown. This is an internal interface so
usage should be restricted to the SDK.
Supported notification classes are setup within NotificationCenter()
as an unmodifiable map so additional notifications must be added there.
Currently supported notification classes are:
* ActivateNotification
* TrackNotification
* DecisionNotification with this class replacing ActivateNotification| Modifier and Type | Class and Description |
|---|---|
static class |
NotificationCenter.DecisionNotificationType |
static class |
NotificationCenter.NotificationType
Deprecated.
|
| Constructor and Description |
|---|
NotificationCenter() |
| Modifier and Type | Method and Description |
|---|---|
int |
addActivateNotificationListener(ActivateNotificationListenerInterface activateNotificationListener)
Deprecated.
|
<T> int |
addNotificationHandler(java.lang.Class<T> clazz,
NotificationHandler<T> handler) |
int |
addNotificationListener(NotificationCenter.NotificationType notificationType,
NotificationListener notificationListener)
Deprecated.
|
int |
addTrackNotificationListener(TrackNotificationListenerInterface trackNotificationListener)
Deprecated.
|
void |
clearAllNotificationListeners()
Clear out all the notification listeners.
|
void |
clearNotificationListeners(java.lang.Class clazz)
Clear notification listeners by notification class.
|
void |
clearNotificationListeners(NotificationCenter.NotificationType notificationType)
Deprecated.
|
<T> NotificationManager<T> |
getNotificationManager(java.lang.Class clazz) |
boolean |
removeNotificationListener(int notificationID)
Remove the notification listener based on the notificationId passed back from addDecisionNotificationHandler.
|
void |
send(java.lang.Object notification) |
@Nullable public <T> NotificationManager<T> getNotificationManager(java.lang.Class clazz)
public <T> int addNotificationHandler(java.lang.Class<T> clazz,
NotificationHandler<T> handler)
@Deprecated public int addActivateNotificationListener(ActivateNotificationListenerInterface activateNotificationListener)
NotificationManager.addHandler(NotificationHandler)activateNotificationListener - The ActivateNotificationListener@Deprecated public int addTrackNotificationListener(TrackNotificationListenerInterface trackNotificationListener)
NotificationManager.addHandler(NotificationHandler)trackNotificationListener - The TrackNotificationListener@Deprecated public int addNotificationListener(NotificationCenter.NotificationType notificationType, NotificationListener notificationListener)
NotificationManager.addHandler(NotificationHandler)notificationType - - enum NotificationType to add.notificationListener - - Notification to add.public boolean removeNotificationListener(int notificationID)
notificationID - the id passed back from add notification.public void clearAllNotificationListeners()
@Deprecated public void clearNotificationListeners(NotificationCenter.NotificationType notificationType)
clearNotificationListeners(Class)notificationType - type of notificationsListeners to remove.public void clearNotificationListeners(java.lang.Class clazz)
clazz - The NotificationLister classpublic void send(java.lang.Object notification)