Eliminate BindingToNormalizedNodeCodecFactory.getOrCreateInstance()
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / md / sal / binding / compat / NotificationInvoker.java
index 08a147721f71ccad7569a7e61fce07cdc0bad17e..f98c8b8a53f3f6d1476ef9df377e7fbab112e285 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.md.sal.binding.compat;
 
 import com.google.common.collect.ImmutableMap;
+import com.google.common.reflect.TypeToken;
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -28,7 +29,8 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
     private NotificationInvoker(final NotificationListener listener) {
         delegate = listener;
         final Map<Class<? extends Notification>, InvokerContext> builder = new HashMap<>();
-        for(final Class<?> iface : listener.getClass().getInterfaces()) {
+        for(final TypeToken<?> ifaceToken : TypeToken.of(listener.getClass()).getTypes().interfaces()) {
+            final Class<?> iface = ifaceToken.getRawType();
             if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
                 @SuppressWarnings("unchecked")
                 final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;
@@ -52,7 +54,7 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
     @Override
     public void onNotification(final Notification notification) {
         getContext(notification.getImplementedInterface()).invoke(notification);
-    };
+    }
 
     private InvokerContext getContext(final Class<?> type) {
         return invokers.get(type);
@@ -72,7 +74,7 @@ final class NotificationInvoker implements org.opendaylight.controller.sal.bindi
         return ret;
     }
 
-    private class InvokerContext {
+    private final class InvokerContext {
 
         private final QName name;
         private final NotificationListenerInvoker invoker;