Fix checkstyle in mdsal-binding-generator-impl
[mdsal.git] / binding / mdsal-binding-generator-impl / src / main / java / org / opendaylight / mdsal / binding / generator / util / BindingRuntimeContext.java
index f40ff9cd69f0566b90cccefa6378e4d39689dbc7..a2ca55bf24628e0bfc8baf29491a8aca2bf4a80d 100644 (file)
@@ -30,7 +30,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.Set;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.mdsal.binding.generator.api.BindingRuntimeTypes;
 import org.opendaylight.mdsal.binding.generator.api.ClassLoadingStrategy;
 import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
@@ -252,10 +252,6 @@ public final class BindingRuntimeContext implements Immutable {
         return found;
     }
 
-    private static Type referencedType(final Class<?> type) {
-        return new ReferencedTypeImpl(JavaTypeName.create(type));
-    }
-
     /**
      * Returns schema ({@link DataSchemaNode}, {@link AugmentationSchemaNode} or {@link TypeDefinition})
      * from which supplied class was generated. Returned schema may be augmented with
@@ -329,6 +325,22 @@ public final class BindingRuntimeContext implements Immutable {
         return getEnumMapping(findTypeWithSchema(enumClassName));
     }
 
+    private static BiMap<String, String> getEnumMapping(final Entry<GeneratedType, WithStatus> typeWithSchema) {
+        final TypeDefinition<?> typeDef = (TypeDefinition<?>) typeWithSchema.getValue();
+
+        Preconditions.checkArgument(typeDef instanceof EnumTypeDefinition);
+        final EnumTypeDefinition enumType = (EnumTypeDefinition) typeDef;
+
+        final HashBiMap<String, String> mappedEnums = HashBiMap.create();
+
+        for (final EnumTypeDefinition.EnumPair enumPair : enumType.getValues()) {
+            mappedEnums.put(enumPair.getName(), BindingMapping.getClassName(enumPair.getName()));
+        }
+
+        // TODO cache these maps for future use
+        return mappedEnums;
+    }
+
     private Entry<GeneratedType, WithStatus> findTypeWithSchema(final String className) {
         // All we have is a straight FQCN, which we need to split into a hierarchical JavaTypeName. This involves
         // some amount of guesswork -- we do that by peeling components at the dot and trying out, e.g. given
@@ -375,22 +387,6 @@ public final class BindingRuntimeContext implements Immutable {
         throw new IllegalArgumentException("Failed to find type for " + className);
     }
 
-    private static BiMap<String, String> getEnumMapping(final Entry<GeneratedType, WithStatus> typeWithSchema) {
-        final TypeDefinition<?> typeDef = (TypeDefinition<?>) typeWithSchema.getValue();
-
-        Preconditions.checkArgument(typeDef instanceof EnumTypeDefinition);
-        final EnumTypeDefinition enumType = (EnumTypeDefinition) typeDef;
-
-        final HashBiMap<String, String> mappedEnums = HashBiMap.create();
-
-        for (final EnumTypeDefinition.EnumPair enumPair : enumType.getValues()) {
-            mappedEnums.put(enumPair.getName(), BindingMapping.getClassName(enumPair.getName()));
-        }
-
-        // TODO cache these maps for future use
-        return mappedEnums;
-    }
-
     public Set<Class<?>> getCases(final Class<?> choice) {
         final Collection<Type> cazes = runtimeTypes.findCases(referencedType(choice));
         final Set<Class<?>> ret = new HashSet<>(cazes.size());
@@ -449,6 +445,10 @@ public final class BindingRuntimeContext implements Immutable {
         return new AugmentationIdentifier(childNames);
     }
 
+    private static Type referencedType(final Class<?> type) {
+        return new ReferencedTypeImpl(JavaTypeName.create(type));
+    }
+
     private static Type referencedType(final Type type) {
         if (type instanceof ReferencedTypeImpl) {
             return type;