Search in sources :

Example 1 with NotificationListenerInvoker

use of org.opendaylight.yangtools.yang.binding.util.NotificationListenerInvoker in project controller by opendaylight.

the class BindingDOMNotificationListenerAdapter method createInvokerMapFor.

public static Map<SchemaPath, NotificationListenerInvoker> createInvokerMapFor(final Class<? extends NotificationListener> implClz) {
    final Map<SchemaPath, NotificationListenerInvoker> builder = new HashMap<>();
    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;
            final NotificationListenerInvoker invoker = NotificationListenerInvoker.from(listenerType);
            for (final SchemaPath path : getNotificationTypes(listenerType)) {
                builder.put(path, invoker);
            }
        }
    }
    return ImmutableMap.copyOf(builder);
}
Also used : SchemaPath(org.opendaylight.yangtools.yang.model.api.SchemaPath) HashMap(java.util.HashMap) NotificationListenerInvoker(org.opendaylight.yangtools.yang.binding.util.NotificationListenerInvoker) DOMNotificationListener(org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener) NotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener)

Aggregations

HashMap (java.util.HashMap)1 DOMNotificationListener (org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener)1 NotificationListener (org.opendaylight.yangtools.yang.binding.NotificationListener)1 NotificationListenerInvoker (org.opendaylight.yangtools.yang.binding.util.NotificationListenerInvoker)1 SchemaPath (org.opendaylight.yangtools.yang.model.api.SchemaPath)1