package org.opendaylight.controller.md.sal.binding.impl;
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;
@Override
public void onNotification(@Nonnull final DOMNotification notification) {
- final Notification baNotification =
- codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
+ final Notification baNotification = deserialize(notification);
final QName notificationQName = notification.getType().getLastComponent();
getInvoker(notification.getType()).invokeNotification(delegate, notificationQName, baNotification);
}
+ private Notification deserialize(final DOMNotification notification) {
+ if(notification instanceof LazySerializedDOMNotification) {
+ return ((LazySerializedDOMNotification) notification).getBindingData();
+ }
+ return codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody());
+ }
+
private NotificationListenerInvoker getInvoker(final SchemaPath type) {
return invokers.get(type);
}
return invokers.keySet();
}
- private static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(final Class<? extends NotificationListener> implClz) {
+ public static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(final Class<? extends NotificationListener> implClz) {
final Map<SchemaPath, NotificationListenerInvoker> builder = new HashMap<>();
- for(final Class<?> iface : implClz.getInterfaces()) {
+ for(final TypeToken<?> ifaceToken : TypeToken.of(implClz).getTypes().interfaces()) {
+ Class<?> iface = ifaceToken.getRawType();
if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) {
@SuppressWarnings("unchecked")
final Class<? extends NotificationListener> listenerType = (Class<? extends NotificationListener>) iface;