Class NotificationSystem


  • public class NotificationSystem
    extends java.lang.Object
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends Notification>
      void
      addListeners​(java.lang.String type, Listener<T> listener, java.util.concurrent.ScheduledExecutorService executor)  
      boolean isListenerPresent​(java.lang.String type)
      Check if a Listener is present for a given notification type.
      <T extends Notification>
      void
      notify​(T notification)
      This method will ensure the notification is intimated to the listeners of the same type.
      <T extends Notification>
      void
      removeListener​(java.lang.String type, Listener<T> listener)
      Remove Listener of a given notification type.
      void removeListeners​(java.lang.String type)
      Remove all listeners of a notification type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NotificationSystem

        public NotificationSystem()
    • Method Detail

      • addListeners

        public <T extends Notification> void addListeners​(java.lang.String type,
                                                          Listener<T> listener,
                                                          java.util.concurrent.ScheduledExecutorService executor)
      • notify

        public <T extends Notification> void notify​(T notification)
        This method will ensure the notification is intimated to the listeners of the same type.
        Type Parameters:
        T - Type of notification.
        Parameters:
        notification - Notification to be notified.
      • removeListener

        public <T extends Notification> void removeListener​(java.lang.String type,
                                                            Listener<T> listener)
        Remove Listener of a given notification type.
        Type Parameters:
        T - Type of notification.
        Parameters:
        type - Type of notification listener.
        listener - Listener to be removed.
      • removeListeners

        public void removeListeners​(java.lang.String type)
        Remove all listeners of a notification type.
        Parameters:
        type - Type of notification listener.
      • isListenerPresent

        public boolean isListenerPresent​(java.lang.String type)
        Check if a Listener is present for a given notification type.
        Parameters:
        type - Type of notification listener.
        Returns:
        true if Listener is present.