Removed sonar warnings. 31/48031/7
authorDana Kutenicsova <dana.kutenics@gmail.com>
Wed, 12 Oct 2016 18:59:16 +0000 (20:59 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 21 Nov 2016 08:29:50 +0000 (08:29 +0000)
Change-Id: Iad015c6deab0f6fb432c36265ada159afac57b13
Signed-off-by: Dana Kutenicsova <dana.kutenics@gmail.com>
13 files changed:
binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding2/generator/impl/AugmentToGenType.java
binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding2/generator/impl/BindingGeneratorImpl.java
binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding2/generator/impl/GenHelperUtil.java
binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding2/generator/impl/ModuleToGenType.java
binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding2/generator/impl/util/YangTextTemplate.java
binding2/mdsal-binding2-generator-impl/src/main/java/org/opendaylight/mdsal/binding2/generator/yang/types/TypeProviderImpl.java
binding2/mdsal-binding2-generator-util/src/main/java/org/opendaylight/mdsal/binding2/generator/util/AbstractBaseType.java
binding2/mdsal-binding2-generator-util/src/main/java/org/opendaylight/mdsal/binding2/generator/util/Binding2GeneratorUtil.java
binding2/mdsal-binding2-generator-util/src/main/java/org/opendaylight/mdsal/binding2/generator/util/Binding2Mapping.java
binding2/mdsal-binding2-generator-util/src/main/java/org/opendaylight/mdsal/binding2/generator/util/BindingTypes.java
binding2/mdsal-binding2-generator-util/src/main/java/org/opendaylight/mdsal/binding2/generator/util/Types.java
binding2/mdsal-binding2-generator-util/src/main/java/org/opendaylight/mdsal/binding2/generator/util/generated/type/builder/EnumerationBuilderImpl.java
binding2/mdsal-binding2-generator-util/src/main/java/org/opendaylight/mdsal/binding2/generator/util/generated/type/builder/GeneratedTOBuilderImpl.java

index 6b6e4fa7575903e1ea511307c474ce6a2c161526..d8f09b9cb2edb94321ed1bfa1dc65f2a62c6aa85 100644 (file)
@@ -8,19 +8,9 @@
 
 package org.opendaylight.mdsal.binding2.generator.impl;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-import static org.opendaylight.mdsal.binding2.generator.impl.GenHelperUtil.findCaseByPath;
-import static org.opendaylight.mdsal.binding2.generator.impl.GenHelperUtil.findChildNodeByPath;
-import static org.opendaylight.mdsal.binding2.generator.impl.GenHelperUtil.processUsesAugments;
-import static org.opendaylight.mdsal.binding2.generator.impl.GenHelperUtil.resolveDataSchemaNodes;
-import static org.opendaylight.mdsal.binding2.generator.util.Binding2GeneratorUtil.packageNameForAugmentedGeneratedType;
-import static org.opendaylight.mdsal.binding2.generator.util.Binding2GeneratorUtil.packageNameForGeneratedType;
-import static org.opendaylight.mdsal.binding2.generator.util.Binding2Mapping.getRootPackageName;
-import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNode;
-
 import com.google.common.annotations.Beta;
 import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -28,6 +18,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import org.opendaylight.mdsal.binding2.generator.util.Binding2GeneratorUtil;
+import org.opendaylight.mdsal.binding2.generator.util.Binding2Mapping;
 import org.opendaylight.mdsal.binding2.generator.util.ReferencedTypeImpl;
 import org.opendaylight.mdsal.binding2.model.api.Type;
 import org.opendaylight.mdsal.binding2.model.api.type.builder.GeneratedTypeBuilder;
@@ -50,10 +42,6 @@ import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 @Beta
 final class AugmentToGenType {
 
-    private AugmentToGenType() {
-        throw new UnsupportedOperationException("Utility class");
-    }
-
     /**
      * Comparator based on augment target path.
      */
@@ -75,6 +63,10 @@ final class AugmentToGenType {
         return otherIt.hasNext() ? -1 : 0;
     };
 
+    private AugmentToGenType() {
+        throw new UnsupportedOperationException("Utility class");
+    }
+
     /**
      * Converts all <b>augmentation</b> of the module to the list
      * <code>Type</code> objects.
@@ -94,21 +86,22 @@ final class AugmentToGenType {
      * @throws IllegalStateException
      *             if set of augmentations from module is null
      */
-    static Map<Module, ModuleContext> generate(final Module module, final SchemaContext schemaContext, Map<Module,
-            ModuleContext> genCtx, Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders,
+    static Map<Module, ModuleContext> generate(final Module module, final SchemaContext schemaContext,
+            final Map<Module, ModuleContext> genCtx, Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders,
             final boolean verboseClassComments) {
 
-        checkArgument(module != null, "Module reference cannot be NULL.");
-        checkArgument(module.getName() != null, "Module name cannot be NULL.");
-        checkState(module.getAugmentations() != null, "Augmentations Set cannot be NULL.");
+        Preconditions.checkArgument(module != null, "Module reference cannot be NULL.");
+        Preconditions.checkArgument(module.getName() != null, "Module name cannot be NULL.");
+        Preconditions.checkState(module.getAugmentations() != null, "Augmentations Set cannot be NULL.");
 
-        final String basePackageName = getRootPackageName(module);
+        final String basePackageName = Binding2Mapping.getRootPackageName(module);
         final List<AugmentationSchema> augmentations = resolveAugmentations(module);
+        Map<Module, ModuleContext> resultCtx = genCtx;
         for (final AugmentationSchema augment : augmentations) {
-            genCtx = augmentationToGenTypes(basePackageName, augment, module, schemaContext, verboseClassComments,
-                    genCtx, genTypeBuilders);
+            resultCtx = augmentationToGenTypes(basePackageName, augment, module, schemaContext, verboseClassComments,
+                    resultCtx, genTypeBuilders);
         }
-        return genCtx;
+        return resultCtx;
     }
 
     /**
@@ -126,8 +119,8 @@ final class AugmentToGenType {
      *             if set of module augmentations is null
      */
     private static List<AugmentationSchema> resolveAugmentations(final Module module) {
-        checkArgument(module != null, "Module reference cannot be NULL.");
-        checkState(module.getAugmentations() != null, "Augmentations Set cannot be NULL.");
+        Preconditions.checkArgument(module != null, "Module reference cannot be NULL.");
+        Preconditions.checkState(module.getAugmentations() != null, "Augmentations Set cannot be NULL.");
 
         final Set<AugmentationSchema> augmentations = module.getAugmentations();
         final List<AugmentationSchema> sortedAugmentations = new ArrayList<>(augmentations);
@@ -168,16 +161,17 @@ final class AugmentToGenType {
             Map<Module, ModuleContext> genCtx, Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders) {
 
         Map<Module, ModuleContext> generatedCtx;
-        checkArgument(augmentPackageName != null, "Package Name cannot be NULL.");
-        checkArgument(augSchema != null, "Augmentation Schema cannot be NULL.");
-        checkState(augSchema.getTargetPath() != null,
+        Preconditions.checkArgument(augmentPackageName != null, "Package Name cannot be NULL.");
+        Preconditions.checkArgument(augSchema != null, "Augmentation Schema cannot be NULL.");
+        Preconditions.checkState(augSchema.getTargetPath() != null,
                 "Augmentation Schema does not contain Target Path (Target Path is NULL).");
 
-        generatedCtx = processUsesAugments(schemaContext, augSchema, module, genCtx, genTypeBuilders, verboseClassComments);
+        generatedCtx = GenHelperUtil.processUsesAugments(schemaContext, augSchema, module, genCtx, genTypeBuilders,
+                verboseClassComments);
         final SchemaPath targetPath = augSchema.getTargetPath();
         SchemaNode targetSchemaNode;
 
-        targetSchemaNode = findDataSchemaNode(schemaContext, targetPath);
+        targetSchemaNode = SchemaContextUtil.findDataSchemaNode(schemaContext, targetPath);
         if (targetSchemaNode instanceof DataSchemaNode && ((DataSchemaNode) targetSchemaNode).isAddedByUses()) {
             if (targetSchemaNode instanceof DerivableSchemaNode) {
                 targetSchemaNode = ((DerivableSchemaNode) targetSchemaNode).getOriginal().orNull();
@@ -191,9 +185,10 @@ final class AugmentToGenType {
             throw new IllegalArgumentException("augment target not found: " + targetPath);
         }
 
-        GeneratedTypeBuilder targetTypeBuilder = findChildNodeByPath(targetSchemaNode.getPath(), generatedCtx);
+        GeneratedTypeBuilder targetTypeBuilder = GenHelperUtil.findChildNodeByPath(targetSchemaNode.getPath(),
+                generatedCtx);
         if (targetTypeBuilder == null) {
-            targetTypeBuilder = findCaseByPath(targetSchemaNode.getPath(), generatedCtx);
+            targetTypeBuilder = GenHelperUtil.findCaseByPath(targetSchemaNode.getPath(), generatedCtx);
         }
         if (targetTypeBuilder == null) {
             throw new NullPointerException("Target type not yet generated: " + targetSchemaNode);
@@ -222,21 +217,23 @@ final class AugmentToGenType {
                         final boolean verboseClassComments) {
 
         Map<Module, ModuleContext> generatedCtx;
-        checkArgument(augmentPackageName != null, "Package Name cannot be NULL.");
-        checkArgument(augSchema != null, "Augmentation Schema cannot be NULL.");
-        checkState(augSchema.getTargetPath() != null,
+        Preconditions.checkArgument(augmentPackageName != null, "Package Name cannot be NULL.");
+        Preconditions.checkArgument(augSchema != null, "Augmentation Schema cannot be NULL.");
+        Preconditions.checkState(augSchema.getTargetPath() != null,
                 "Augmentation Schema does not contain Target Path (Target Path is NULL).");
 
-        generatedCtx = processUsesAugments(schemaContext, augSchema, module, genCtx, genTypeBuilders, verboseClassComments);
+        generatedCtx = GenHelperUtil.processUsesAugments(schemaContext, augSchema, module, genCtx, genTypeBuilders,
+                verboseClassComments);
         final SchemaPath targetPath = augSchema.getTargetPath();
         final SchemaNode targetSchemaNode = findOriginalTargetFromGrouping(schemaContext, targetPath, usesNode);
         if (targetSchemaNode == null) {
             throw new IllegalArgumentException("augment target not found: " + targetPath);
         }
 
-        GeneratedTypeBuilder targetTypeBuilder = findChildNodeByPath(targetSchemaNode.getPath(), generatedCtx);
+        GeneratedTypeBuilder targetTypeBuilder = GenHelperUtil.findChildNodeByPath(targetSchemaNode.getPath(),
+                generatedCtx);
         if (targetTypeBuilder == null) {
-            targetTypeBuilder = findCaseByPath(targetSchemaNode.getPath(), generatedCtx);
+            targetTypeBuilder = GenHelperUtil.findCaseByPath(targetSchemaNode.getPath(), generatedCtx);
         }
         if (targetTypeBuilder == null) {
             throw new NullPointerException("Target type not yet generated: " + targetSchemaNode);
@@ -245,7 +242,8 @@ final class AugmentToGenType {
         if (!(targetSchemaNode instanceof ChoiceSchemaNode)) {
             String packageName = augmentPackageName;
             if (usesNodeParent instanceof SchemaNode) {
-                packageName = packageNameForAugmentedGeneratedType(augmentPackageName, ((SchemaNode) usesNodeParent).getPath());
+                packageName = Binding2GeneratorUtil.packageNameForAugmentedGeneratedType(augmentPackageName,
+                        ((SchemaNode) usesNodeParent).getPath());
             }
             generatedCtx = GenHelperUtil.addRawAugmentGenTypeDefinition(module, packageName, augmentPackageName,
                     targetTypeBuilder.toInstance(), augSchema, genTypeBuilders, generatedCtx);
@@ -351,28 +349,29 @@ final class AugmentToGenType {
                           final Iterable<DataSchemaNode> augmentedNodes, final DataNodeContainer usesNodeParent,
                           Map<Module, ModuleContext> genCtx, final boolean verboseClassComments,
                           Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders) {
-        checkArgument(basePackageName != null, "Base Package Name cannot be NULL.");
-        checkArgument(targetType != null, "Referenced Choice Type cannot be NULL.");
-        checkArgument(augmentedNodes != null, "Set of Choice Case Nodes cannot be NULL.");
+        Preconditions.checkArgument(basePackageName != null, "Base Package Name cannot be NULL.");
+        Preconditions.checkArgument(targetType != null, "Referenced Choice Type cannot be NULL.");
+        Preconditions.checkArgument(augmentedNodes != null, "Set of Choice Case Nodes cannot be NULL.");
 
         for (final DataSchemaNode caseNode : augmentedNodes) {
             if (caseNode != null) {
-                final String packageName = packageNameForGeneratedType(basePackageName, caseNode.getPath());
+                final String packageName = Binding2GeneratorUtil.packageNameForGeneratedType(basePackageName,
+                        caseNode.getPath());
                 final GeneratedTypeBuilder caseTypeBuilder = GenHelperUtil.addDefaultInterfaceDefinition(packageName,
                         caseNode, module, genCtx, schemaContext, verboseClassComments, genTypeBuilders);
                 caseTypeBuilder.addImplementsType(targetType);
 
                 SchemaNode parent;
                 final SchemaPath nodeSp = targetNode.getPath();
-                parent = findDataSchemaNode(schemaContext, nodeSp.getParent());
+                parent = SchemaContextUtil.findDataSchemaNode(schemaContext, nodeSp.getParent());
 
                 GeneratedTypeBuilder childOfType = null;
                 if (parent instanceof Module) {
                     childOfType = genCtx.get(parent).getModuleNode();
                 } else if (parent instanceof ChoiceCaseNode) {
-                    childOfType = findCaseByPath(parent.getPath(), genCtx);
+                    childOfType = GenHelperUtil.findCaseByPath(parent.getPath(), genCtx);
                 } else if (parent instanceof DataSchemaNode || parent instanceof NotificationDefinition) {
-                    childOfType = findChildNodeByPath(parent.getPath(), genCtx);
+                    childOfType = GenHelperUtil.findChildNodeByPath(parent.getPath(), genCtx);
                 } else if (parent instanceof GroupingDefinition) {
                     childOfType = GenHelperUtil.findGroupingByPath(parent.getPath(), genCtx);
                 }
@@ -399,7 +398,8 @@ final class AugmentToGenType {
                 }
                 final Iterable<DataSchemaNode> childNodes = node.getChildNodes();
                 if (childNodes != null) {
-                    resolveDataSchemaNodes(module, basePackageName, caseTypeBuilder, childOfType, childNodes);
+                    GenHelperUtil.resolveDataSchemaNodes(module, basePackageName, caseTypeBuilder, childOfType,
+                            childNodes);
                 }
                 genCtx.get(module).addCaseType(caseNode.getPath(), caseTypeBuilder);
                 genCtx.get(module).addChoiceToCaseMapping(targetType, caseTypeBuilder, node);
index bad95da52f5802c4b642f916dae48212b05aefd4..73159c1645e2ac668e6a914ba6d8553e86dde35d 100644 (file)
@@ -5,14 +5,10 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.mdsal.binding2.generator.impl;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
 import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -51,15 +47,6 @@ public class BindingGeneratorImpl implements BindingGenerator {
 
     private Map<Module, ModuleContext> genCtx = new HashMap<>();
 
-    /**
-     * Creates a new binding generator v2.
-     *
-     * @param verboseClassComments generate verbose comments
-     */
-    public BindingGeneratorImpl(final boolean verboseClassComments) {
-        this.verboseClassComments = verboseClassComments;
-    }
-
     /**
      * Provide methods for converting YANG types to JAVA types.
      */
@@ -72,27 +59,30 @@ public class BindingGeneratorImpl implements BindingGenerator {
     private SchemaContext schemaContext;
 
     /**
-     * Resolves generated types from <code>context</code> schema nodes of all
-     * modules.
+     * Creates a new binding generator v2.
+     *
+     * @param verboseClassComments generate verbose comments
+     */
+    public BindingGeneratorImpl(final boolean verboseClassComments) {
+        this.verboseClassComments = verboseClassComments;
+    }
+
+    /**
+     * Resolves generated types from <code>context</code> schema nodes of all modules.
      *
-     * Generated types are created for modules, groupings, types, containers,
-     * lists, choices, augments, rpcs, notification, identities.
+     * Generated types are created for modules, groupings, types, containers, lists, choices, augments, rpcs,
+     * notification, identities.
      *
-     * @param context
-     *            schema context which contains data about all schema nodes
-     *            saved in modules
-     * @return list of types (usually <code>GeneratedType</code>
-     *         <code>GeneratedTransferObject</code>which are generated from
-     *         <code>context</code> data.
-     * @throws IllegalArgumentException
-     *             if arg <code>context</code> is null
-     * @throws IllegalStateException
-     *             if <code>context</code> contain no modules
+     * @param context schema context which contains data about all schema nodes saved in modules
+     * @return list of types (usually <code>GeneratedType</code> <code>GeneratedTransferObject</code>which are generated
+     *         from <code>context</code> data.
+     * @throws IllegalArgumentException if arg <code>context</code> is null
+     * @throws IllegalStateException if <code>context</code> contain no modules
      */
     @Override
     public List<Type> generateTypes(SchemaContext context) {
-        checkArgument(context != null, "Schema Context reference cannot be NULL.");
-        checkState(context.getModules() != null, "Schema Context does not contain defined modules.");
+        Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL.");
+        Preconditions.checkState(context.getModules() != null, "Schema Context does not contain defined modules.");
         schemaContext = context;
         typeProvider = new TypeProviderImpl(context);
         final Set<Module> modules = context.getModules();
@@ -101,9 +91,9 @@ public class BindingGeneratorImpl implements BindingGenerator {
 
     @Override
     public List<Type> generateTypes(SchemaContext context, Set<Module> modules) {
-        checkArgument(context != null, "Schema Context reference cannot be NULL.");
-        checkState(context.getModules() != null, "Schema Context does not contain defined modules.");
-        checkArgument(modules != null, "Set of Modules cannot be NULL.");
+        Preconditions.checkArgument(context != null, "Schema Context reference cannot be NULL.");
+        Preconditions.checkState(context.getModules() != null, "Schema Context does not contain defined modules.");
+        Preconditions.checkArgument(modules != null, "Set of Modules cannot be NULL.");
 
         schemaContext = context;
         typeProvider = new TypeProviderImpl(context);
@@ -121,7 +111,8 @@ public class BindingGeneratorImpl implements BindingGenerator {
 
         final List<Type> filteredGenTypes = new ArrayList<>();
         for (final Module m : modules) {
-            final ModuleContext ctx = checkNotNull(genCtx.get(m), "Module context not found for module %s", m);
+            final ModuleContext ctx = Preconditions.checkNotNull(genCtx.get(m),
+                    "Module context not found for module %s", m);
             filteredGenTypes.addAll(ctx.getGeneratedTypes());
             final Set<Type> additionalTypes = ((TypeProviderImpl) typeProvider).getAdditionalTypes().get(m);
             if (additionalTypes != null) {
index 3951410be0c0da95d5ab4dd8b90a906b524558c3..555bdc263496e6b38b4a6068464c859a3c81d0df 100644 (file)
@@ -8,14 +8,9 @@
 
 package org.opendaylight.mdsal.binding2.generator.impl;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.opendaylight.mdsal.binding2.generator.impl.AugmentToGenType.usesAugmentationToGenTypes;
-import static org.opendaylight.mdsal.binding2.generator.util.BindingTypes.TREE_ROOT;
-import static org.opendaylight.mdsal.binding2.generator.util.BindingTypes.augmentable;
-import static org.opendaylight.mdsal.binding2.generator.util.Types.typeForClass;
-
 import com.google.common.annotations.Beta;
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
 import com.google.common.base.Strings;
 import com.google.common.collect.Iterables;
@@ -34,8 +29,6 @@ import org.opendaylight.mdsal.binding2.model.api.GeneratedType;
 import org.opendaylight.mdsal.binding2.model.api.Type;
 import org.opendaylight.mdsal.binding2.model.api.type.builder.GeneratedTypeBuilder;
 import org.opendaylight.mdsal.binding2.model.api.type.builder.GeneratedTypeBuilderBase;
-import org.opendaylight.mdsal.binding2.txt.yangTemplateForModule;
-import org.opendaylight.mdsal.binding2.txt.yangTemplateForNode;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
@@ -53,7 +46,8 @@ import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.UsesNode;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-
+import org.opendaylight.mdsal.binding2.txt.yangTemplateForModule;
+import org.opendaylight.mdsal.binding2.txt.yangTemplateForNode;
 
 /**
  * Helper util class used for generation of types in binding spec v2.
@@ -61,10 +55,6 @@ import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 @Beta
 final class GenHelperUtil {
 
-    private GenHelperUtil() {
-        throw new UnsupportedOperationException("Util class");
-    }
-
     private static final Pattern UNICODE_CHAR_PATTERN = Pattern.compile("\\\\+u");
     private static final Splitter BSDOT_SPLITTER = Splitter.on("\\.");
     private static final char NEW_LINE = '\n';
@@ -79,6 +69,9 @@ final class GenHelperUtil {
      */
     private static final String YANG_EXT_NAMESPACE = "urn:opendaylight:yang:extension:yang-ext";
 
+    private GenHelperUtil() {
+        throw new UnsupportedOperationException("Util class");
+    }
 
     /**
      * Create GeneratedTypeBuilder object from module argument.
@@ -94,11 +87,11 @@ final class GenHelperUtil {
      *             if module is null
      */
     static GeneratedTypeBuilder moduleToDataType(final Module module, Map<Module, ModuleContext> genCtx, final boolean verboseClassComments) {
-        checkArgument(module != null, "Module reference cannot be NULL.");
+        Preconditions.checkArgument(module != null, "Module reference cannot be NULL.");
 
         final GeneratedTypeBuilder moduleDataTypeBuilder = moduleTypeBuilder(module, "Data", verboseClassComments);
         addImplementedInterfaceFromUses(module, moduleDataTypeBuilder, genCtx);
-        moduleDataTypeBuilder.addImplementsType(TREE_ROOT);
+        moduleDataTypeBuilder.addImplementsType(BindingTypes.TREE_ROOT);
         moduleDataTypeBuilder.addComment(module.getDescription());
         moduleDataTypeBuilder.setDescription(createDescription(module, verboseClassComments));
         moduleDataTypeBuilder.setReference(module.getReference());
@@ -121,7 +114,7 @@ final class GenHelperUtil {
      *             if <code>module</code> is null
      */
     static GeneratedTypeBuilder moduleTypeBuilder(final Module module, final String postfix, final boolean verboseClassComments) {
-        checkArgument(module != null, "Module reference cannot be NULL.");
+        Preconditions.checkArgument(module != null, "Module reference cannot be NULL.");
         final String packageName = Binding2Mapping.getRootPackageName(module);
         final String moduleName = Binding2Mapping.getClassName(module.getName()) + postfix;
 
@@ -251,7 +244,8 @@ final class GenHelperUtil {
         final String basePackageName = Binding2Mapping.getRootPackageName(module);
         for (final UsesNode usesNode : node.getUses()) {
             for (final AugmentationSchema augment : usesNode.getAugmentations()) {
-                genCtx = usesAugmentationToGenTypes(schemaContext, basePackageName, augment, module, usesNode,
+                genCtx = AugmentToGenType.usesAugmentationToGenTypes(schemaContext, basePackageName, augment, module,
+                        usesNode,
                         node, genCtx, genTypeBuilders, verboseClassComments);
                 genCtx = processUsesAugments(schemaContext, augment, module, genCtx, genTypeBuilders, verboseClassComments);
             }
@@ -452,7 +446,7 @@ final class GenHelperUtil {
             it.addImplementsType(BindingTypes.treeChildNode(parent));
         }
         if (!(schemaNode instanceof GroupingDefinition)) {
-            it.addImplementsType(augmentable(it));
+            it.addImplementsType(BindingTypes.augmentable(it));
         }
 
         if (schemaNode instanceof DataNodeContainer) {
@@ -493,11 +487,11 @@ final class GenHelperUtil {
     private static GeneratedTypeBuilder addRawInterfaceDefinition(final String packageName, final SchemaNode schemaNode,
                        final SchemaContext schemaContext, final String prefix, final boolean verboseClassComments,
                        Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders) {
-        checkArgument(schemaNode != null, "Data Schema Node cannot be NULL.");
-        checkArgument(packageName != null, "Package Name for Generated Type cannot be NULL.");
-        checkArgument(schemaNode.getQName() != null, "QName for Data Schema Node cannot be NULL.");
+        Preconditions.checkArgument(schemaNode != null, "Data Schema Node cannot be NULL.");
+        Preconditions.checkArgument(packageName != null, "Package Name for Generated Type cannot be NULL.");
+        Preconditions.checkArgument(schemaNode.getQName() != null, "QName for Data Schema Node cannot be NULL.");
         final String schemaNodeName = schemaNode.getQName().getLocalName();
-        checkArgument(schemaNodeName != null, "Local Name of QName for Data Schema Node cannot be NULL.");
+        Preconditions.checkArgument(schemaNodeName != null, "Local Name of QName for Data Schema Node cannot be NULL.");
 
         String genTypeName;
         if (prefix == null) {
@@ -532,7 +526,7 @@ final class GenHelperUtil {
 
     private static Constant qNameConstant(final GeneratedTypeBuilderBase<?> toBuilder, final String constantName,
                                           final QName name) {
-        return toBuilder.addConstant(typeForClass(QName.class), constantName, name);
+        return toBuilder.addConstant(Types.typeForClass(QName.class), constantName, name);
     }
 
     private static String createDescription(final SchemaNode schemaNode, final String fullyQualifiedName,
index 5ef8f390d99254ca7e5c0f40f9a0fd4e902f8a9c..60c7e317f24904d3a00fd9490a6d59f3d3e0904e 100644 (file)
@@ -8,10 +8,8 @@
 
 package org.opendaylight.mdsal.binding2.generator.impl;
 
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-
 import com.google.common.annotations.Beta;
+import com.google.common.base.Preconditions;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -68,11 +66,11 @@ final class ModuleToGenType {
      */
     private static Map<Module, ModuleContext> allTypeDefinitionsToGenTypes(final Module module, Map<Module, ModuleContext> genCtx,
                                                      TypeProvider typeProvider) {
-        checkArgument(module != null, "Module reference cannot be NULL.");
-        checkArgument(module.getName() != null, "Module name cannot be NULL.");
+        Preconditions.checkArgument(module != null, "Module reference cannot be NULL.");
+        Preconditions.checkArgument(module.getName() != null, "Module name cannot be NULL.");
         final DataNodeIterator it = new DataNodeIterator(module);
         final List<TypeDefinition<?>> typeDefinitions = it.allTypedefs();
-        checkState(typeDefinitions != null, "Type Definitions for module Â«module.name» cannot be NULL.");
+        Preconditions.checkState(typeDefinitions != null, "Type Definitions for module Â«module.name» cannot be NULL.");
 
         typeDefinitions.stream().filter(typedef -> typedef != null).forEach(typedef -> {
             final Type type = ((TypeProviderImpl) typeProvider).generatedTypeForExtendedDefinitionType(typedef,
index f59e5a07635a81002a7ab4c404107688fd636e06..1baf96066e8c723cb1794e96ada07ff211198d09 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.mdsal.binding2.generator.impl.util;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 import com.google.common.annotations.Beta;
 import com.google.common.base.CharMatcher;
 import com.google.common.base.Preconditions;
@@ -17,7 +15,6 @@ import com.google.common.base.Strings;
 import com.google.common.collect.Iterables;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.regex.Pattern;
 import org.opendaylight.mdsal.binding2.generator.util.Types;
 import org.opendaylight.mdsal.binding2.model.api.GeneratedType;
 import org.opendaylight.mdsal.binding2.model.api.ParameterizedType;
@@ -37,8 +34,6 @@ public final class YangTextTemplate {
     private static final CharMatcher NL_MATCHER = CharMatcher.is(NEW_LINE);
     private static final CharMatcher AMP_MATCHER = CharMatcher.is('&');
     private static final Splitter NL_SPLITTER = Splitter.on(NL_MATCHER);
-    private static final CharMatcher TAB_MATCHER = CharMatcher.is('\t');
-    private static final Pattern SPACES_PATTERN = Pattern.compile(" +");
 
     private YangTextTemplate() {
         throw new UnsupportedOperationException("Util class");
@@ -139,9 +134,10 @@ public final class YangTextTemplate {
      */
     public static void putTypeIntoImports(final GeneratedType parentGenType, final Type type,
         final Map<String, String> imports) {
-        checkArgument(parentGenType != null, "Parent Generated Type parameter MUST be specified and cannot be NULL!");
-        checkArgument(type != null, "Type parameter MUST be specified and cannot be NULL!");
-        checkArgument(parentGenType.getPackageName() != null,
+        Preconditions.checkArgument(parentGenType != null,
+                "Parent Generated Type parameter MUST be specified and cannot be NULL!");
+        Preconditions.checkArgument(type != null, "Type parameter MUST be specified and cannot be NULL!");
+        Preconditions.checkArgument(parentGenType.getPackageName() != null,
                 "Parent Generated Type cannot have Package Name referenced as NULL!");
 
         final String typeName = Preconditions.checkNotNull(type.getName());
@@ -175,8 +171,8 @@ public final class YangTextTemplate {
      */
     public static String getExplicitType(final GeneratedType parentGenType, final Type type,
         final Map<String, String> imports) {
-        checkArgument(type != null, "Type parameter MUST be specified and cannot be NULL!");
-        checkArgument(imports != null, "Imports Map cannot be NULL!");
+        Preconditions.checkArgument(type != null, "Type parameter MUST be specified and cannot be NULL!");
+        Preconditions.checkArgument(imports != null, "Imports Map cannot be NULL!");
 
         final String typePackageName = Preconditions.checkNotNull(type.getPackageName());
         final String typeName = Preconditions.checkNotNull(type.getName());
@@ -185,7 +181,7 @@ public final class YangTextTemplate {
         if (typePackageName.equals(importedPackageName)) {
             builder = new StringBuilder(typeName);
             addActualTypeParameters(builder, type, parentGenType, imports);
-            if (builder.toString().equals("Void")) {
+            if ("Void".equals(builder.toString())) {
                 return "void";
             }
         } else {
index 6a90b5d59f6b1be3b8999dc85c505e5d0bd6068e..fbb26e0898d9e06d85c7004c9f5c6d71fd891a6b 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.mdsal.binding2.generator.yang.types;
 
-import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findParentModule;
-
 import com.google.common.annotations.Beta;
 import com.google.common.base.Preconditions;
 import java.util.Date;
@@ -26,14 +24,11 @@ import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 
 @Beta
 public final class TypeProviderImpl implements TypeProvider {
 
-    private static final Logger LOG = LoggerFactory.getLogger(TypeProviderImpl.class);
-
     /**
      * Contains the schema data red from YANG files.
      */
@@ -110,7 +105,7 @@ public final class TypeProviderImpl implements TypeProvider {
 
         final TypeDefinition<?> baseTypeDef = baseTypeDefForExtendedType(typeDefinition);
         if (!(baseTypeDef instanceof LeafrefTypeDefinition) && !(baseTypeDef instanceof IdentityrefTypeDefinition)) {
-            final Module module = findParentModule(schemaContext, parentNode);
+            final Module module = SchemaContextUtil.findParentModule(schemaContext, parentNode);
 
             if (module != null) {
                 final Map<Date, Map<String, Type>> modulesByDate = genTypeDefsContextMap.get(module.getName());
index a1c13e28e8dfb65971a45a253330495a09d96250..00d5d9336ced94af2635e2c111a6f787ab4aea8d 100644 (file)
@@ -17,7 +17,7 @@ import org.opendaylight.mdsal.binding2.model.api.Type;
  * This class represents ancestor for other <code>Type</code>s
  */
 @Beta
-abstract public class AbstractBaseType implements Type {
+public abstract class AbstractBaseType implements Type {
 
     /**
      * Name of the package to which this <code>Type</code> belongs.
index e3a70aeb09c2cb2d64576b89067c1ad3ed849484..19062cae696180f2310aeb5293ed0d2b7991aa89 100644 (file)
@@ -10,19 +10,10 @@ package org.opendaylight.mdsal.binding2.generator.util;
 
 import com.google.common.annotations.Beta;
 import com.google.common.base.CharMatcher;
-import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;
-import java.util.Comparator;
 import java.util.Iterator;
-import java.util.List;
-import org.opendaylight.mdsal.binding2.model.api.Restrictions;
-import org.opendaylight.mdsal.binding2.model.api.Type;
-import org.opendaylight.mdsal.binding2.model.api.type.builder.TypeMemberBuilder;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
-import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 
 /**
  * Standard Util class that contains various method for converting
@@ -32,40 +23,12 @@ import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 @Beta
 public final class Binding2GeneratorUtil {
 
-    private Binding2GeneratorUtil() {
-        throw new UnsupportedOperationException("Utility class");
-    }
-
     private static final CharMatcher GT_MATCHER = CharMatcher.is('>');
     private static final CharMatcher LT_MATCHER = CharMatcher.is('<');
 
-    private static final Restrictions EMPTY_RESTRICTIONS = new Restrictions() {
-        @Override
-        public List<LengthConstraint> getLengthConstraints() {
-            return ImmutableList.of();
-        }
-
-        @Override
-        public List<PatternConstraint> getPatternConstraints() {
-            return ImmutableList.of();
-        }
-
-        @Override
-        public List<RangeConstraint> getRangeConstraints() {
-            return ImmutableList.of();
-        }
-
-        @Override
-        public boolean isEmpty() {
-            return true;
-        }
-    };
-
-    private static final Comparator<TypeMemberBuilder<?>> SUID_MEMBER_COMPARATOR =
-            (o1, o2) -> o1.getName().compareTo(o2.getName());
-
-    private static final Comparator<Type> SUID_NAME_COMPARATOR =
-            (o1, o2) -> o1.getFullyQualifiedName().compareTo(o2.getFullyQualifiedName());
+    private Binding2GeneratorUtil() {
+        throw new UnsupportedOperationException("Utility class");
+    }
 
     /**
      * Creates package name from specified <code>basePackageName</code> (package
@@ -148,11 +111,12 @@ public final class Binding2GeneratorUtil {
      * @return string with encoded angle brackets
      */
     public static String encodeAngleBrackets(String description) {
-        if (description != null) {
-            description = LT_MATCHER.replaceFrom(description, "&lt;");
-            description = GT_MATCHER.replaceFrom(description, "&gt;");
+        String newDesc = description;
+        if (newDesc != null) {
+            newDesc = LT_MATCHER.replaceFrom(newDesc, "&lt;");
+            newDesc = GT_MATCHER.replaceFrom(newDesc, "&gt;");
         }
-        return description;
+        return newDesc;
     }
 
     //TODO: further implementation of static util methods...
index 8c69e788fc9e403db96092b706eff19c80f25bbd..696ca15e9f0189af30326cbb66eae3bf9b50abc3 100644 (file)
@@ -8,10 +8,9 @@
 
 package org.opendaylight.mdsal.binding2.generator.util;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 import com.google.common.annotations.Beta;
 import com.google.common.base.CharMatcher;
+import com.google.common.base.Preconditions;
 import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Interner;
@@ -29,10 +28,6 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 @Beta
 public final class Binding2Mapping {
 
-    private Binding2Mapping() {
-        throw new UnsupportedOperationException("Utility class");
-    }
-
     public static final Set<String> JAVA_RESERVED_WORDS = ImmutableSet.of("abstract", "assert", "boolean", "break",
             "byte", "case", "catch", "char", "class", "const", "continue", "default", "double", "do", "else", "enum",
             "extends", "false", "final", "finally", "float", "for", "goto", "if", "implements", "import", "instanceof",
@@ -67,10 +62,14 @@ public final class Binding2Mapping {
         }
     };
 
+    private Binding2Mapping() {
+        throw new UnsupportedOperationException("Utility class");
+    }
+
     public static String getRootPackageName(final Module module) {
-        checkArgument(module != null, "Module must not be null");
-        checkArgument(module.getRevision() != null, "Revision must not be null");
-        checkArgument(module.getNamespace() != null, "Namespace must not be null");
+        Preconditions.checkArgument(module != null, "Module must not be null");
+        Preconditions.checkArgument(module.getRevision() != null, "Revision must not be null");
+        Preconditions.checkArgument(module.getNamespace() != null, "Namespace must not be null");
 
         final StringBuilder packageNameBuilder = new StringBuilder();
         packageNameBuilder.append(PACKAGE_PREFIX);
@@ -95,6 +94,9 @@ public final class Binding2Mapping {
                 case ';':
                 case '=':
                     chars[i] = '.';
+                    break;
+                default:
+                    // no-op, any other character is kept as it is
             }
         }
 
@@ -140,12 +142,12 @@ public final class Binding2Mapping {
     }
 
     public static String getClassName(final String localName) {
-        checkArgument(localName != null, "Name should not be null.");
+        Preconditions.checkArgument(localName != null, "Name should not be null.");
         return toFirstUpper(toCamelCase(localName));
     }
 
     private static String toCamelCase(final String rawString) {
-        checkArgument(rawString != null, "String should not be null");
+        Preconditions.checkArgument(rawString != null, "String should not be null");
         Iterable<String> components = CAMEL_SPLITTER.split(rawString);
         StringBuilder builder = new StringBuilder();
         for (String comp : components) {
index d8eceeb082cffa9e34b6c1cc8151e3b1f8edd8e3..833b4e8b225cf667dbb9ed0a7a7f9d8340202e88 100644 (file)
@@ -8,9 +8,6 @@
 
 package org.opendaylight.mdsal.binding2.generator.util;
 
-import static org.opendaylight.mdsal.binding2.generator.util.Types.parameterizedTypeFor;
-import static org.opendaylight.mdsal.binding2.generator.util.Types.typeForClass;
-
 import javax.management.NotificationListener;
 import org.opendaylight.mdsal.binding2.model.api.ConcreteType;
 import org.opendaylight.mdsal.binding2.model.api.ParameterizedType;
@@ -27,28 +24,28 @@ import org.opendaylight.yangtools.concepts.Identifier;
 
 public final class BindingTypes {
 
-    public static final ConcreteType AUGMENTABLE = typeForClass(Augmentable.class);
-    public static final ConcreteType AUGMENTATION = typeForClass(Augmentation.class);
-    public static final ConcreteType TREE_NODE = typeForClass(TreeNode.class);
-    public static final ConcreteType TREE_ROOT = typeForClass(TreeRoot.class);
-    public static final ConcreteType IDENTIFIABLE_ITEM = typeForClass(IdentifiableItem.class);
-    public static final ConcreteType IDENTIFIER = typeForClass(Identifier.class);
-    public static final ConcreteType INSTANCE_IDENTIFIER = typeForClass(InstanceIdentifier.class);
-    public static final ConcreteType NOTIFICATION = typeForClass(Notification.class);
-    public static final ConcreteType NOTIFICATION_LISTENER = typeForClass(NotificationListener.class);
+    public static final ConcreteType AUGMENTABLE = Types.typeForClass(Augmentable.class);
+    public static final ConcreteType AUGMENTATION = Types.typeForClass(Augmentation.class);
+    public static final ConcreteType TREE_NODE = Types.typeForClass(TreeNode.class);
+    public static final ConcreteType TREE_ROOT = Types.typeForClass(TreeRoot.class);
+    public static final ConcreteType IDENTIFIABLE_ITEM = Types.typeForClass(IdentifiableItem.class);
+    public static final ConcreteType IDENTIFIER = Types.typeForClass(Identifier.class);
+    public static final ConcreteType INSTANCE_IDENTIFIER = Types.typeForClass(InstanceIdentifier.class);
+    public static final ConcreteType NOTIFICATION = Types.typeForClass(Notification.class);
+    public static final ConcreteType NOTIFICATION_LISTENER = Types.typeForClass(NotificationListener.class);
 
-    private static final ConcreteType TREE_CHILD_NODE = typeForClass(TreeChildNode.class);
+    private static final ConcreteType TREE_CHILD_NODE = Types.typeForClass(TreeChildNode.class);
 
     private BindingTypes() {
         throw new UnsupportedOperationException("Utility class");
     }
 
     public static ParameterizedType augmentable(Type t) {
-        return parameterizedTypeFor(AUGMENTABLE, t);
+        return Types.parameterizedTypeFor(AUGMENTABLE, t);
     }
 
     public static ParameterizedType treeChildNode(Type t) {
-        return parameterizedTypeFor(TREE_CHILD_NODE, t);
+        return Types.parameterizedTypeFor(TREE_CHILD_NODE, t);
     }
 
 }
index 57976ce1b1110b7a2dcb4c9be97ac113956be335..80946153a057c415ca988dec4cd5c89b8e7526e0 100644 (file)
@@ -225,9 +225,8 @@ public final class Types {
         return parameterizedTypeFor(augmentation, valueType);
     }
 
-
-    public static  @Nullable
-    String getOuterClassName(final Type valueType) {
+    @Nullable
+    public static String getOuterClassName(final Type valueType) {
         final String pkgName = valueType.getPackageName();
         if(CharMatcher.JAVA_UPPER_CASE.indexIn(pkgName) >= 0) {
             // It is inner class.
@@ -309,17 +308,6 @@ public final class Types {
          */
         private final Type rawType;
 
-        @Override
-        public Type[] getActualTypeArguments() {
-
-            return actualTypes;
-        }
-
-        @Override
-        public Type getRawType() {
-            return rawType;
-        }
-
         /**
          * Creates instance of this class with concrete rawType and array of
          * actual parameters.
@@ -335,6 +323,16 @@ public final class Types {
             this.actualTypes = actTypes.clone();
         }
 
+        @Override
+        public Type[] getActualTypeArguments() {
+
+            return actualTypes;
+        }
+
+        @Override
+        public Type getRawType() {
+            return rawType;
+        }
     }
 
     /**
@@ -361,13 +359,11 @@ public final class Types {
     }
 
     private static final class DefaultRestrictions<T extends Number> implements Restrictions {
-        private final T min;
-        private final T max;
         private final List<RangeConstraint> rangeConstraints;
 
         private DefaultRestrictions(final T min, final T max) {
-            this.min = Preconditions.checkNotNull(min);
-            this.max = Preconditions.checkNotNull(max);
+            Preconditions.checkNotNull(min);
+            Preconditions.checkNotNull(max);
             this.rangeConstraints = Collections.singletonList(BaseConstraints.newRangeConstraint(min, max, Optional
                     .absent(), Optional.absent()));
         }
index b1b6bf8f5cbe064383ed4172a27ad09ffd8bc08d..0f04ed9bd630894262aeb147904145df1ecbc898 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.mdsal.binding2.generator.util.generated.type.builder;
 import com.google.common.annotations.Beta;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
@@ -42,10 +41,8 @@ public class EnumerationBuilderImpl extends AbstractBaseType implements EnumBuil
     private final String name;
     private List<Pair> values = ImmutableList.of();
     private List<AnnotationTypeBuilder> annotationBuilders = ImmutableList.of();
-    private List<Pair> unmodifiableValues  = ImmutableList.of();
     private String description;
     private String reference;
-    private Status status;
     private String moduleName;
     private List<QName> schemaPath;
 
@@ -67,10 +64,6 @@ public class EnumerationBuilderImpl extends AbstractBaseType implements EnumBuil
         this.schemaPath = schemaPath;
     }
 
-    public void setStatus(final Status status) {
-        this.status = status;
-    }
-
     @Override
     public void setDescription(String description) {
         this.description = description;
@@ -89,13 +82,12 @@ public class EnumerationBuilderImpl extends AbstractBaseType implements EnumBuil
     public void addValue(String name, int value, String description, String reference, Status status) {
         final EnumPairImpl p = new EnumPairImpl(name, value, description, reference, status);
         values = LazyCollections.lazyAdd(values, p);
-        unmodifiableValues = Collections.unmodifiableList(values);
     }
 
     @Override
     public Enumeration toInstance(Type definingType) {
         return new EnumerationImpl(definingType, annotationBuilders, packageName, name, values, description,
-                reference, status, moduleName, schemaPath);
+                reference, moduleName, schemaPath);
     }
 
     @Override
@@ -220,7 +212,6 @@ public class EnumerationBuilderImpl extends AbstractBaseType implements EnumBuil
         private final Type definingType;
         private final String description;
         private final String reference;
-        private final Status status;
         private final String moduleName;
         private final List<QName> schemaPath;
         private final List<Pair> values;
@@ -228,14 +219,12 @@ public class EnumerationBuilderImpl extends AbstractBaseType implements EnumBuil
 
         public EnumerationImpl(final Type definingType, final List<AnnotationTypeBuilder> annotationBuilders,
                                final String packageName, final String name, final List<Pair> values, final String description,
-                               final String reference, final Status status, final String moduleName, final
-                               List<QName> schemaPath) {
+                final String reference, final String moduleName, final List<QName> schemaPath) {
             super(packageName, name);
             this.definingType = definingType;
             this.values = values;
             this.description = description;
             this.reference = reference;
-            this.status = status;
             this.moduleName = moduleName;
             this.schemaPath = schemaPath;
 
@@ -347,9 +336,5 @@ public class EnumerationBuilderImpl extends AbstractBaseType implements EnumBuil
         public List<GeneratedProperty> getProperties() {
             return ImmutableList.of();
         }
-
-        public Status getStatus() {
-            return status;
-        }
     }
 }
index 4126201df68b69871e1f7e710cc5a0ef885b5c57..259aed7e8fe2d502b06741728c79b6a0f0b2dc17 100644 (file)
@@ -12,7 +12,6 @@ import com.google.common.annotations.Beta;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
-import java.util.Collections;
 import java.util.List;
 import org.opendaylight.mdsal.binding2.model.api.GeneratedProperty;
 import org.opendaylight.mdsal.binding2.model.api.GeneratedTransferObject;
@@ -39,7 +38,7 @@ public final class GeneratedTOBuilderImpl extends AbstractGeneratedTypeBuilder<G
     private boolean isUnionTypeBuilder = false;
     private TypeDefinition<?> baseType = null;
     private Restrictions restrictions;
-    private GeneratedPropertyBuilder SUID;
+    private GeneratedPropertyBuilder suid;
     private String reference;
     private String description;
     private String moduleName;
@@ -128,7 +127,7 @@ public final class GeneratedTOBuilderImpl extends AbstractGeneratedTypeBuilder<G
 
     @Override
     public void setSUID(GeneratedPropertyBuilder suid) {
-        this.SUID = suid;
+        this.suid = suid;
     }
 
     @Override
@@ -194,7 +193,7 @@ public final class GeneratedTOBuilderImpl extends AbstractGeneratedTypeBuilder<G
         private final boolean isUnionType;
         private final boolean isUnionTypeBuilder;
         private final Restrictions restrictions;
-        private final GeneratedProperty SUID;
+        private final GeneratedProperty innerSuid;
         private final String reference;
         private final String description;
         private final String moduleName;
@@ -218,16 +217,16 @@ public final class GeneratedTOBuilderImpl extends AbstractGeneratedTypeBuilder<G
             this.moduleName = builder.moduleName;
             this.schemaPath = builder.schemaPath;
 
-            if (builder.SUID == null) {
-                this.SUID = null;
+            if (builder.suid == null) {
+                this.innerSuid = null;
             } else {
-                this.SUID = builder.SUID.toInstance(GeneratedTransferObjectImpl.this);
+                this.innerSuid = builder.suid.toInstance(GeneratedTransferObjectImpl.this);
             }
         }
 
         @Override
         public GeneratedProperty getSUID() {
-            return SUID;
+            return innerSuid;
         }
 
         @Override