public class InterfacesHelper {
+ private InterfacesHelper() {
+ }
+
public static Set<Class<?>> getAllInterfaces(Class<?> clazz) {
if (clazz.isInterface()) {
throw new IllegalArgumentException(clazz
}
private static Set<Class<?>> getAllSuperInterfaces(Set<Class<?>> ifcs) {
- ifcs = new HashSet<>(ifcs); // create copy to modify
+ Set<Class<?>> interfaces = new HashSet<>(ifcs); // create copy to modify
// each interface can extend other interfaces
Set<Class<?>> result = new HashSet<>();
- while (ifcs.size() > 0) {
- Iterator<Class<?>> iterator = ifcs.iterator();
+ while (!interfaces.isEmpty()) {
+ Iterator<Class<?>> 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;
*/
public static Set<Class<?>> getOsgiRegistrationTypes(
Class<? extends Module> configBeanClass) {
- // TODO test with service interface hierarchy
Set<Class<?>> serviceInterfaces = getServiceInterfaces(configBeanClass);
Set<Class<?>> result = new HashSet<>();
for (Class<?> clazz : serviceInterfaces) {