Add InstanceNotification(Publish)ServiceAdapter
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / main / java / org / opendaylight / mdsal / binding / dom / adapter / AbstractDOMNotificationListenerAdapter.java
index 4740420f3fa96ff58e21ba5e4f71105f8835fa50..eae5f768f0da95cdaeae41b2b5fc3240dbf5b70e 100644 (file)
@@ -8,6 +8,7 @@
  */
 package org.opendaylight.mdsal.binding.dom.adapter;
 
+import static com.google.common.base.Verify.verify;
 import static com.google.common.base.Verify.verifyNotNull;
 import static java.util.Objects.requireNonNull;
 
@@ -36,16 +37,18 @@ abstract class AbstractDOMNotificationListenerAdapter implements DOMNotification
     abstract Set<Absolute> getSupportedNotifications();
 
     private Notification<?> deserialize(final DOMNotification notification) {
-        if (notification instanceof LazySerializedDOMNotification) {
+        if (notification instanceof LazySerializedNotification) {
             // TODO: This is a routed-back notification, for which we may end up losing event time here, but that is
             //       okay, for now at least.
-            return ((LazySerializedDOMNotification) notification).getBindingData();
+            return ((LazySerializedNotification) notification).getBindingData();
         }
 
-        final CurrentAdapterSerializer serializer = adapterContext.currentSerializer();
-        return notification instanceof DOMEvent
+        final var serializer = adapterContext.currentSerializer();
+        final var result = notification instanceof DOMEvent
             ? serializer.fromNormalizedNodeNotification(notification.getType(), notification.getBody(),
                 ((DOMEvent) notification).getEventInstant())
                 : serializer.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
+        verify(result instanceof Notification, "Unexpected codec result %s", result);
+        return (Notification<?>) result;
     }
 }