*/
package org.opendaylight.controller.config.manager.impl.util;
+import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import org.opendaylight.controller.config.spi.Module;
import org.opendaylight.controller.config.spi.ModuleFactory;
-public class InterfacesHelper {
+public final class InterfacesHelper {
private InterfacesHelper() {
}
}
// getInterfaces gets interfaces implemented directly by this class
Set<Class<?>> toBeInspected = new HashSet<>();
- while (clazz.equals(Object.class) == false) {
+ while (!clazz.equals(Object.class)) {
toBeInspected.addAll(Arrays.asList(clazz.getInterfaces()));
// get parent class
clazz = clazz.getSuperclass();
Iterator<Class<?>> iterator = interfaces.iterator();
Class<?> ifc = iterator.next();
iterator.remove();
- if (ifc.isInterface() == false) {
+ if (!ifc.isInterface()) {
throw new IllegalArgumentException(ifc + " should be an interface");
}
interfaces.addAll(Arrays.asList(ifc.getInterfaces()));
Set<Class<? extends AbstractServiceInterface>> foundGeneratedSIClasses = new HashSet<>();
for (Class<?> clazz : getAllInterfaces(configBeanClass)) {
- if (AbstractServiceInterface.class.isAssignableFrom(clazz) && AbstractServiceInterface.class.equals(clazz) == false) {
+ if (AbstractServiceInterface.class.isAssignableFrom(clazz) && !AbstractServiceInterface.class.equals(clazz)) {
foundGeneratedSIClasses.add((Class<? extends AbstractServiceInterface>) clazz);
}
}
for (ServiceInterfaceAnnotation sia: siAnnotations) {
qNames.add(sia.value());
}
- return Collections.unmodifiableSet(qNames);
+ return ImmutableSet.copyOf(qNames);
}
public static Set<ServiceInterfaceAnnotation> getServiceInterfaceAnnotations(final ModuleFactory factory) {
Set<Class<? extends AbstractServiceInterface>> result = new HashSet<>();
for(Class<?> ifc: allInterfaces){
if (AbstractServiceInterface.class.isAssignableFrom(ifc) &&
- ifc.equals(AbstractServiceInterface.class) == false) {
+ !ifc.equals(AbstractServiceInterface.class)) {
result.add((Class<? extends AbstractServiceInterface>) ifc);
}