SimpleDOMQueryResult should be a record
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMNotificationService.java
index 46f0f44a60bb49cc371844e250af0dc61884d775..283215a7e52adb6f6c161a86e06027f8f8329ed7 100644 (file)
@@ -9,18 +9,19 @@ package org.opendaylight.mdsal.dom.api;
 
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Map;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
 
 /**
- * A {@link DOMService} which allows its users to subscribe to receive
- * {@link DOMNotification}s.
+ * A {@link DOMService} which allows its users to subscribe to receive top-level (YANG 1.0) {@link DOMNotification}s.
  */
 public interface DOMNotificationService extends DOMService {
     /**
      * Register a {@link DOMNotificationListener} to receive a set of notifications. As with other
-     * ListenerRegistration-based interfaces, registering an instance multiple times results in
+     * {@link ListenerRegistration}-based interfaces, registering an instance multiple times results in
      * notifications being delivered for each registration.
      *
      * @param listener Notification instance to register
@@ -29,15 +30,15 @@ public interface DOMNotificationService extends DOMService {
      * @return Registration handle. Invoking {@link ListenerRegistration#close()} will stop the
      *         delivery of notifications to the listener
      * @throws IllegalArgumentException if types is empty or contains an invalid element, such as
-     *         null or a SchemaPath which does not represent a valid {@link DOMNotification} type.
+     *         null or a schema node identifier which does not represent a valid {@link DOMNotification} type.
      * @throws NullPointerException if either of the arguments is null
      */
-    <T extends DOMNotificationListener> ListenerRegistration<T>
-            registerNotificationListener(@NonNull T listener, @NonNull Collection<SchemaPath> types);
+    <T extends DOMNotificationListener> @NonNull ListenerRegistration<T>
+            registerNotificationListener(@NonNull T listener, @NonNull Collection<Absolute> types);
 
     /**
      * Register a {@link DOMNotificationListener} to receive a set of notifications. As with other
-     * ListenerRegistration-based interfaces, registering an instance multiple times results in
+     * {@link ListenerRegistration}-based interfaces, registering an instance multiple times results in
      * notifications being delivered for each registration.
      *
      * @param listener Notification instance to register
@@ -46,11 +47,21 @@ public interface DOMNotificationService extends DOMService {
      * @return Registration handle. Invoking {@link ListenerRegistration#close()} will stop the
      *         delivery of notifications to the listener
      * @throws IllegalArgumentException if types is empty or contains an invalid element, such as
-     *         null or a SchemaPath which does not represent a valid {@link DOMNotification} type.
+     *         null or a schema node identifier which does not represent a valid {@link DOMNotification} type.
      * @throws NullPointerException if listener is null
      */
-    default <T extends DOMNotificationListener> ListenerRegistration<T>
-            registerNotificationListener(@NonNull final T listener, final SchemaPath... types) {
+    default <T extends DOMNotificationListener> @NonNull ListenerRegistration<T>
+            registerNotificationListener(@NonNull final T listener, final Absolute... types) {
         return registerNotificationListener(listener, Arrays.asList(types));
     }
+
+    /**
+     * Register a number of {@link DOMNotificationListener}s to receive some notification notifications. As with other
+     * {@link Registration}-based interfaces, registering an instance multiple times results in
+     * notifications being delivered for each registration.
+     *
+     * @param typeToListener Specification of which types to listen to with which listeners
+     * @throws NullPointerException if {@code typeToListener} is {@code null}
+     */
+    @NonNull Registration registerNotificationListeners(@NonNull Map<Absolute, DOMNotificationListener> typeToListener);
 }