X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Futil%2FInterfacesHelper.java;h=4d94c6d2655650ece2f9bcb1a26a3e0b872a7d60;hp=033f7222fcc7fd64103e25336a3b81f669d14adc;hb=8161319be53a57e3ac22ba72f267483526e11e0d;hpb=cf000a86e871a4acf98cf15ba31ce140e6c0f262 diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/InterfacesHelper.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/InterfacesHelper.java index 033f7222fc..4d94c6d265 100644 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/InterfacesHelper.java +++ b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/util/InterfacesHelper.java @@ -21,6 +21,9 @@ import java.util.Set; public class InterfacesHelper { + private InterfacesHelper() { + } + public static Set> getAllInterfaces(Class clazz) { if (clazz.isInterface()) { throw new IllegalArgumentException(clazz @@ -38,17 +41,17 @@ public class InterfacesHelper { } private static Set> getAllSuperInterfaces(Set> ifcs) { - ifcs = new HashSet<>(ifcs); // create copy to modify + Set> interfaces = new HashSet<>(ifcs); // create copy to modify // each interface can extend other interfaces Set> result = new HashSet<>(); - while (ifcs.size() > 0) { - Iterator> iterator = ifcs.iterator(); + while (!interfaces.isEmpty()) { + Iterator> iterator = interfaces.iterator(); Class ifc = iterator.next(); iterator.remove(); if (ifc.isInterface() == false) { throw new IllegalArgumentException(ifc + " should be an interface"); } - ifcs.addAll(Arrays.asList(ifc.getInterfaces())); + interfaces.addAll(Arrays.asList(ifc.getInterfaces())); result.add(ifc); } return result; @@ -109,7 +112,6 @@ public class InterfacesHelper { */ public static Set> getOsgiRegistrationTypes( Class configBeanClass) { - // TODO test with service interface hierarchy Set> serviceInterfaces = getServiceInterfaces(configBeanClass); Set> result = new HashSet<>(); for (Class clazz : serviceInterfaces) { @@ -120,6 +122,13 @@ public class InterfacesHelper { return result; } + public static Set getQNames(Set siAnnotations) { + Set qNames = new HashSet<>(); + for (ServiceInterfaceAnnotation sia: siAnnotations) { + qNames.add(sia.value()); + } + return Collections.unmodifiableSet(qNames); + } public static Set getServiceInterfaceAnnotations(ModuleFactory factory) { Set> implementedServiceIntefaces = Collections.unmodifiableSet(factory.getImplementedServiceIntefaces()); @@ -136,7 +145,7 @@ public class InterfacesHelper { result.add(annotation); } } - return result; + return Collections.unmodifiableSet(result); } static Set> getAllAbstractServiceInterfaceClasses(