Search in sources :

Example 1 with ModuleQName

use of org.opendaylight.yangtools.yang.binding.annotations.ModuleQName in project controller by opendaylight.

the class ModuleQNameUtil method getQNames.

public static Set<String> getQNames(final Map<String, Entry<ModuleFactory, BundleContext>> resolved) {
    final Set<String> result = new HashSet<>();
    for (final Entry<ModuleFactory, BundleContext> entry : resolved.values()) {
        Class<?> inspected = entry.getKey().getClass();
        if (inspected.isInterface()) {
            throw new IllegalArgumentException("Unexpected interface " + inspected);
        }
        ModuleQName annotation = null;
        while (annotation == null && inspected != null) {
            annotation = inspected.getAnnotation(ModuleQName.class);
            inspected = inspected.getSuperclass();
        }
        if (annotation != null) {
            result.add(QName.create(annotation.namespace(), annotation.revision(), annotation.name()).toString());
        }
    }
    return result;
}
Also used : ModuleFactory(org.opendaylight.controller.config.spi.ModuleFactory) ModuleQName(org.opendaylight.yangtools.yang.binding.annotations.ModuleQName) HashSet(java.util.HashSet) BundleContext(org.osgi.framework.BundleContext)

Aggregations

HashSet (java.util.HashSet)1 ModuleFactory (org.opendaylight.controller.config.spi.ModuleFactory)1 ModuleQName (org.opendaylight.yangtools.yang.binding.annotations.ModuleQName)1 BundleContext (org.osgi.framework.BundleContext)1