Fix checkstyle in mdsal-binding-generator-impl 78/76878/4
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 11 Oct 2018 13:39:22 +0000 (15:39 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 11 Oct 2018 15:31:18 +0000 (17:31 +0200)
This fixes violations and flips enforcement on.

Change-Id: Ida4e62f4c3ddf4d7d8066f3858e6ab98f0f92cf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
40 files changed:
binding/mdsal-binding-generator-impl/pom.xml
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/AbstractTypeGenerator.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/BindingGeneratorImpl.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/BindingSchemaContextUtils.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/ModuleContext.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/ModuleInfoBackedContext.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/TransformerGeneratorException.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/util/BindingRuntimeContext.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/util/CodeGenerationException.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/util/DefaultSourceCodeGenerator.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/util/JavassistUtils.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/util/SourceCodeGeneratorFactory.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/util/YangSchemaUtils.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/BaseYangTypes.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/CodegenTypeProvider.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/GroupingDefinitionDependencySort.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/NodeWrappedType.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/AugmentRelativeXPathTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/AugmentedTypeTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BinaryTypeTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BindingGeneratorImplTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BitAndUnionTOEnclosingTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/ChoiceCaseGenTypesTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/CodecTypeUtilsTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/GeneratedTypesStringTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/IdentityrefTypeTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/SupportTestUtil.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/TypeProviderIntegrationTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/UnionTypeDefTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/UsesTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/YangTextTemplateTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/util/YangSchemaUtilsTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/GroupingDefinitionDependencySortTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/LeafrefTypeWithNullToStringInXpath.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/LeafrefTypeWithNullXpath.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/NodeWrappedTypeTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/TypeProviderImplTest.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/TypeProviderModel.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/TypeProviderTest.java

index ff44717198dc6fbe43b3560185b7c2afa067d689..be8790c5e975718bcdc446aa3f07aba60de747d4 100644 (file)
                     </instructions>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>
index fd242571c98be016cd93b538cd86cf9ce8be6c7c..f0da9644c9d79c17ff9cb368e2d1f943e8561d1b 100644 (file)
@@ -159,10 +159,9 @@ abstract class AbstractTypeGenerator {
     private final Map<QNameModule, ModuleContext> genCtx = new HashMap<>();
 
     /**
-     * Outer key represents the package name. Outer value represents map of all
-     * builders in the same package. Inner key represents the schema node name
-     * (in JAVA class/interface name format). Inner value represents instance of
-     * builder for schema node specified in key part.
+     * Outer key represents the package name. Outer value represents map of all builders in the same package. Inner key
+     * represents the schema node name (in JAVA class/interface name format). Inner value represents instance of builder
+     * for schema node specified in key part.
      */
     private final Map<String, Map<String, GeneratedTypeBuilder>> genTypeBuilders = new HashMap<>();
 
@@ -172,8 +171,7 @@ abstract class AbstractTypeGenerator {
     private final AbstractTypeProvider typeProvider;
 
     /**
-     * Holds reference to schema context to resolve data of augmented element
-     * when creating augmentation builder
+     * Holds reference to schema context to resolve data of augmented element when creating augmentation builder.
      */
     private final SchemaContext schemaContext;
 
@@ -693,23 +691,14 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Adds enumeration builder created from <code>enumTypeDef</code> to
-     * <code>typeBuilder</code>.
+     * Adds enumeration builder created from <code>enumTypeDef</code> to <code>typeBuilder</code>. Each
+     * <code>enumTypeDef</code> item is added to builder with its name and value.
      *
-     * Each <code>enumTypeDef</code> item is added to builder with its name and
-     * value.
-     *
-     * @param enumTypeDef
-     *            EnumTypeDefinition contains enum data
-     * @param enumName
-     *            string contains name which will be assigned to enumeration
-     *            builder
-     * @param typeBuilder
-     *            GeneratedTypeBuilder to which will be enum builder assigned
-     * @param module
-     *            Module in which type should be generated
-     * @return enumeration builder which contains data from
-     *         <code>enumTypeDef</code>
+     * @param enumTypeDef EnumTypeDefinition contains enum data
+     * @param enumName string contains name which will be assigned to enumeration builder
+     * @param typeBuilder GeneratedTypeBuilder to which will be enum builder assigned
+     * @param module Module in which type should be generated
+     * @return enumeration builder which contains data from <code>enumTypeDef</code>
      */
     private EnumBuilder resolveInnerEnumFromTypeDefinition(final EnumTypeDefinition enumTypeDef, final QName enumName,
             final GeneratedTypeBuilder typeBuilder, final ModuleContext context) {
@@ -726,16 +715,10 @@ abstract class AbstractTypeGenerator {
     /**
      * Generates type builder for <code>module</code>.
      *
-     * @param module
-     *            Module which is source of package name for generated type
-     *            builder
-     * @param postfix
-     *            string which is added to the module class name representation
-     *            as suffix
-     * @return instance of GeneratedTypeBuilder which represents
-     *         <code>module</code>.
-     * @throws IllegalArgumentException
-     *             if <code>module</code> is null
+     * @param module Module which is source of package name for generated type builder
+     * @param postfix string which is added to the module class name representation as suffix
+     * @return instance of GeneratedTypeBuilder which represents <code>module</code>.
+     * @throws IllegalArgumentException if <code>module</code> is null
      */
     private GeneratedTypeBuilder moduleTypeBuilder(final ModuleContext context, final String postfix) {
         final Module module = context.module();
@@ -749,20 +732,13 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Converts <code>augSchema</code> to list of <code>Type</code> which
-     * contains generated type for augmentation. In addition there are also
-     * generated types for all containers, list and choices which are child of
-     * <code>augSchema</code> node or a generated types for cases are added if
-     * augmented node is choice.
+     * Converts <code>augSchema</code> to list of <code>Type</code> which contains generated type for augmentation.
+     * In addition there are also generated types for all containers, list and choices which are child of
+     * <code>augSchema</code> node or a generated types for cases are added if augmented node is choice.
      *
-     * @param augmentPackageName
-     *            string with the name of the package to which the augmentation
-     *            belongs
-     * @param augSchema
-     *            AugmentationSchema which is contains data about augmentation
-     *            (target path, childs...)
-     * @param module
-     *            current module
+     * @param augmentPackageName string with the name of the package to which the augmentation belongs
+     * @param augSchema AugmentationSchema which is contains data about augmentation (target path, childs...)
+     * @param module current module
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>augmentPackageName</code> equals null</li>
@@ -861,10 +837,8 @@ abstract class AbstractTypeGenerator {
     /**
      * Convenient method to find node added by uses statement.
      *
-     * @param targetPath
-     *            node path
-     * @param parentUsesNode
-     *            parent of uses node
+     * @param targetPath node path
+     * @param parentUsesNode parent of uses node
      * @return node from its original location in grouping
      */
     private DataSchemaNode findOriginalTargetFromGrouping(final SchemaPath targetPath, final UsesNode parentUsesNode) {
@@ -907,24 +881,14 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Returns a generated type builder for an augmentation.
-     *
-     * The name of the type builder is equal to the name of augmented node with
-     * serial number as suffix.
+     * Returns a generated type builder for an augmentation. The name of the type builder is equal to the name
+     * of augmented node with serial number as suffix.
      *
-     * @param context
-     *            current module
-     * @param augmentPackageName
-     *            string with contains the package name to which the augment
-     *            belongs
-     * @param basePackageName
-     *            string with the package name to which the augmented node
-     *            belongs
-     * @param targetTypeRef
-     *            target type
-     * @param augSchema
-     *            augmentation schema which contains data about the child nodes
-     *            and uses of augment
+     * @param context current module
+     * @param augmentPackageName string with contains the package name to which the augment belongs
+     * @param basePackageName string with the package name to which the augmented node belongs
+     * @param targetTypeRef target type
+     * @param augSchema augmentation schema which contains data about the child nodes and uses of augment
      * @return generated type builder for augment
      */
     private GeneratedTypeBuilder addRawAugmentGenTypeDefinition(final ModuleContext context,
@@ -965,11 +929,6 @@ abstract class AbstractTypeGenerator {
         return addRawAugmentGenTypeDefinition(context, context.modulePackageName(), targetTypeRef, augSchema);
     }
 
-    /**
-     *
-     * @param unknownSchemaNodes
-     * @return nodeParameter of UnknownSchemaNode
-     */
     private static String getAugmentIdentifier(final List<UnknownSchemaNode> unknownSchemaNodes) {
         for (final UnknownSchemaNode unknownSchemaNode : unknownSchemaNodes) {
             final QName nodeType = unknownSchemaNode.getNodeType();
@@ -982,15 +941,11 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Returns first unique name for the augment generated type builder. The
-     * generated type builder name for augment consists from name of augmented
-     * node and serial number of its augmentation.
+     * Returns first unique name for the augment generated type builder. The generated type builder name for augment
+     * consists from name of augmented node and serial number of its augmentation.
      *
-     * @param builders
-     *            map of builders which were created in the package to which the
-     *            augmentation belongs
-     * @param genTypeName
-     *            string with name of augmented node
+     * @param builders map of builders which were created in the package to which the augmentation belongs
+     * @param genTypeName string with name of augmented node
      * @return string with unique name for augmentation builder
      */
     private static String augGenTypeName(final Map<String, GeneratedTypeBuilder> builders, final String genTypeName) {
@@ -1004,27 +959,19 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Adds the methods to <code>typeBuilder</code> which represent subnodes of
-     * node for which <code>typeBuilder</code> was created.
-     *
-     * The subnodes aren't mapped to the methods if they are part of grouping or
-     * augment (in this case are already part of them).
+     * Adds the methods to <code>typeBuilder</code> which represent subnodes of node for which <code>typeBuilder</code>
+     * was created. The subnodes aren't mapped to the methods if they are part of grouping or augment (in this case are
+     * already part of them).
      *
-     * @param module
-     *            current module
-     * @param parent
-     *            generated type builder which represents any node. The subnodes
-     *            of this node are added to the <code>typeBuilder</code> as
-     *            methods. The subnode can be of type leaf, leaf-list, list,
-     *            container, choice.
-     * @param childOf
-     *            parent type
-     * @param schemaNodes
-     *            set of data schema nodes which are the children of the node
-     *            for which <code>typeBuilder</code> was created
-     * @return generated type builder which is the same builder as input
-     *         parameter. The getter methods (representing child nodes) could be
-     *         added to it.
+     * @param module current module
+     * @param parent generated type builder which represents any node. The subnodes of this node are added
+     *               to the <code>typeBuilder</code> as methods. The subnode can be of type leaf, leaf-list, list,
+     *               container, choice.
+     * @param childOf parent type
+     * @param schemaNodes set of data schema nodes which are the children of the node for which
+     *                    <code>typeBuilder</code> was created
+     * @return generated type builder which is the same builder as input parameter. The getter methods (representing
+     *         child nodes) could be added to it.
      */
     private GeneratedTypeBuilder resolveDataSchemaNodes(final ModuleContext context, final GeneratedTypeBuilder parent,
             final @Nullable Type childOf, final Iterable<DataSchemaNode> schemaNodes) {
@@ -1040,24 +987,18 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Adds the methods to <code>typeBuilder</code> what represents subnodes of
-     * node for which <code>typeBuilder</code> was created.
+     * Adds the methods to <code>typeBuilder</code> what represents subnodes of node for which <code>typeBuilder</code>
+     * was created.
      *
-     * @param module
-     *            current module
-     * @param typeBuilder
-     *            generated type builder which represents any node. The subnodes
-     *            of this node are added to the <code>typeBuilder</code> as
-     *            methods. The subnode can be of type leaf, leaf-list, list,
-     *            container, choice.
-     * @param childOf
-     *            parent type
-     * @param schemaNodes
-     *            set of data schema nodes which are the children of the node
-     *            for which <code>typeBuilder</code> was created
-     * @return generated type builder which is the same object as the input
-     *         parameter <code>typeBuilder</code>. The getter method could be
-     *         added to it.
+     * @param module current module
+     * @param typeBuilder generated type builder which represents any node. The subnodes of this node are added
+     *                    to the <code>typeBuilder</code> as methods. The subnode can be of type leaf, leaf-list, list,
+     *                    container, choice.
+     * @param childOf parent type
+     * @param schemaNodes set of data schema nodes which are the children of the node for which <code>typeBuilder</code>
+     *                    was created
+     * @return generated type builder which is the same object as the input parameter <code>typeBuilder</code>.
+     *         The getter method could be added to it.
      */
     private GeneratedTypeBuilder augSchemaNodeToMethods(final ModuleContext context,
             final GeneratedTypeBuilder typeBuilder, final Iterable<DataSchemaNode> schemaNodes) {
@@ -1073,19 +1014,12 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Adds to <code>typeBuilder</code> a method which is derived from
-     * <code>schemaNode</code>.
+     * Adds to <code>typeBuilder</code> a method which is derived from <code>schemaNode</code>.
      *
-     * @param node
-     *            data schema node which is added to <code>typeBuilder</code> as
-     *            a method
-     * @param typeBuilder
-     *            generated type builder to which is <code>schemaNode</code>
-     *            added as a method.
-     * @param childOf
-     *            parent type
-     * @param module
-     *            current module
+     * @param node data schema node which is added to <code>typeBuilder</code> as a method
+     * @param typeBuilder generated type builder to which is <code>schemaNode</code> added as a method.
+     * @param childOf parent type
+     * @param module current module
      */
     private void addSchemaNodeToBuilderAsMethod(final ModuleContext context, final DataSchemaNode node,
             final GeneratedTypeBuilder typeBuilder, final Type baseInterface) {
@@ -1109,22 +1043,15 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Converts <code>choiceNode</code> to the list of generated types for
-     * choice and its cases.
-     *
-     * The package names for choice and for its cases are created as
-     * concatenation of the module package (<code>basePackageName</code>) and
-     * names of all parents node.
+     * Converts <code>choiceNode</code> to the list of generated types for choice and its cases. The package names
+     * for choice and for its cases are created as concatenation of the module package (<code>basePackageName</code>)
+     * and names of all parents node.
      *
-     * @param context
-     *            current module
-     * @param basePackageName
-     *            string with the module package name
-     * @param parent
-     *            parent type
-     * @param choiceNode
-     *            choice node which is mapped to generated type. Also child
-     *            nodes - cases are mapped to generated types.
+     * @param context current module
+     * @param basePackageName string with the module package name
+     * @param parent parent type
+     * @param choiceNode choice node which is mapped to generated type. Also child nodes - cases are mapped to generated
+     *                   types.
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>basePackageName</code> is null</li>
@@ -1151,19 +1078,14 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Converts <code>caseNodes</code> set to list of corresponding generated types.
-     *
-     * For every <i>case</i> which isn't added through augment or <i>uses</i> is created generated type builder.
-     * The package names for the builder is created as concatenation of the module package and names of all parents
-     * nodes of the concrete <i>case</i>. There is also relation "<i>implements type</i>" between every case builder
-     * and <i>choice</i> type
+     * Converts <code>caseNodes</code> set to list of corresponding generated types. For every <i>case</i> which is not
+     * added through augment or <i>uses</i> is created generated type builder. The package names for the builder is
+     * created as concatenation of the module package and names of all parents nodes of the concrete <i>case</i>. There
+     * is also relation "<i>implements type</i>" between every case builder and <i>choice</i> type
      *
-     * @param context
-     *            current module context
-     * @param refChoiceType
-     *            type which represents superior <i>case</i>
-     * @param choiceNode
-     *            choice case node which is mapped to generated type
+     * @param context current module context
+     * @param refChoiceType type which represents superior <i>case</i>
+     * @param choiceNode choice case node which is mapped to generated type
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>refChoiceType</code> equals null</li>
@@ -1217,30 +1139,24 @@ abstract class AbstractTypeGenerator {
                     } else {
                         resolveDataSchemaNodes(context, caseTypeBuilder, moduleToDataType(context), caseChildNodes);
                     }
-               }
+                }
             }
             processUsesAugments(caseNode, context);
         }
     }
 
     /**
-     * Generates list of generated types for all the cases of a choice which are
-     * added to the choice through the augment.
+     * Generates list of generated types for all the cases of a choice which are added to the choice through
+     * the augment.
      *
-     * @param module
-     *            current module
-     * @param basePackageName
-     *            string contains name of package to which augment belongs. If
-     *            an augmented choice is from an other package (pcg1) than an
-     *            augmenting choice (pcg2) then case's of the augmenting choice
-     *            will belong to pcg2.
-     * @param targetType
-     *            Type which represents target choice
-     * @param targetNode
-     *            node which represents target choice
-     * @param augmentedNodes
-     *            set of choice case nodes for which is checked if are/aren't
-     *            added to choice through augmentation
+     * @param module current module
+     * @param basePackageName string contains name of package to which augment belongs. If an augmented choice is
+     *                        from an other package (pcg1) than an augmenting choice (pcg2) then case's
+     *                        of the augmenting choice will belong to pcg2.
+     * @param targetType Type which represents target choice
+     * @param targetNode node which represents target choice
+     * @param augmentedNodes set of choice case nodes for which is checked if are/are not added to choice through
+     *                       augmentation
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>basePackageName</code> is null</li>
@@ -1339,17 +1255,11 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Converts <code>leaf</code> to the getter method which is added to
-     * <code>typeBuilder</code>.
+     * Converts <code>leaf</code> to the getter method which is added to <code>typeBuilder</code>.
      *
-     * @param typeBuilder
-     *            generated type builder to which is added getter method as
-     *            <code>leaf</code> mapping
-     * @param leaf
-     *            leaf schema node which is mapped as getter method which is
-     *            added to <code>typeBuilder</code>
-     * @param module
-     *            Module in which type was defined
+     * @param typeBuilder generated type builder to which is added getter method as <code>leaf</code> mapping
+     * @param leaf leaf schema node which is mapped as getter method which is added to <code>typeBuilder</code>
+     * @param module Module in which type was defined
      * @return boolean value
      *         <ul>
      *         <li>false - if <code>leaf</code> or <code>typeBuilder</code> are
@@ -1508,19 +1418,12 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Converts <code>leaf</code> schema node to property of generated TO
-     * builder.
+     * Converts <code>leaf</code> schema node to property of generated TO builder.
      *
-     * @param toBuilder
-     *            generated TO builder to which is <code>leaf</code> added as
-     *            property
-     * @param leaf
-     *            leaf schema node which is added to <code>toBuilder</code> as
-     *            property
-     * @param returnType
-     *            property type
-     * @param isReadOnly
-     *            boolean value which says if leaf property is|isn't read only
+     * @param toBuilder generated TO builder to which is <code>leaf</code> added as property
+     * @param leaf leaf schema node which is added to <code>toBuilder</code> as property
+     * @param returnType property type
+     * @param isReadOnly boolean value which says if leaf property is|isn't read only
      * @return boolean value
      *         <ul>
      *         <li>false - if <code>leaf</code>, <code>toBuilder</code> or leaf
@@ -1546,15 +1449,10 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Converts <code>node</code> leaf list schema node to getter method of
-     * <code>typeBuilder</code>.
+     * Converts <code>node</code> leaf list schema node to getter method of <code>typeBuilder</code>.
      *
-     * @param typeBuilder
-     *            generated type builder to which is <code>node</code> added as
-     *            getter method
-     * @param node
-     *            leaf list schema node which is added to
-     *            <code>typeBuilder</code> as getter method
+     * @param typeBuilder generated type builder to which is <code>node</code> added as getter method
+     * @param node leaf list schema node which is added to <code>typeBuilder</code> as getter method
      * @param module module
      * @return boolean value
      *         <ul>
@@ -1659,26 +1557,17 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Instantiates generated type builder with <code>packageName</code> and
-     * <code>schemaNode</code>.
-     *
-     * The new builder always implements
-     * {@link org.opendaylight.yangtools.yang.binding.DataObject DataObject}.<br>
-     * If <code>schemaNode</code> is instance of GroupingDefinition it also
-     * implements {@link org.opendaylight.yangtools.yang.binding.Augmentable
-     * Augmentable}.<br>
+     * Instantiates generated type builder with <code>packageName</code> and <code>schemaNode</code>. The new builder
+     * always implements {@link org.opendaylight.yangtools.yang.binding.DataObject DataObject}.<br>
+     * If <code>schemaNode</code> is instance of GroupingDefinition it also implements
+     * {@link org.opendaylight.yangtools.yang.binding.Augmentable Augmentable}.<br>
      * If <code>schemaNode</code> is instance of
-     * {@link org.opendaylight.yangtools.yang.model.api.DataNodeContainer
-     * DataNodeContainer} it can also implement nodes which are specified in
-     * <i>uses</i>.
+     * {@link org.opendaylight.yangtools.yang.model.api.DataNodeContainer DataNodeContainer} it can also implement nodes
+     * which are specified in <i>uses</i>.
      *
-     * @param packageName
-     *            string with the name of the package to which
-     *            <code>schemaNode</code> belongs.
-     * @param schemaNode
-     *            schema node for which is created generated type builder
-     * @param parent
-     *            parent type (can be null)
+     * @param packageName string with the name of the package to which <code>schemaNode</code> belongs.
+     * @param schemaNode schema node for which is created generated type builder
+     * @param parent parent type (can be null)
      * @return generated type builder <code>schemaNode</code>
      */
     private GeneratedTypeBuilder addDefaultInterfaceDefinition(final String packageName, final SchemaNode schemaNode,
@@ -1706,11 +1595,8 @@ abstract class AbstractTypeGenerator {
     /**
      * Wraps the calling of the same overloaded method.
      *
-     * @param packageName
-     *            string with the package name to which returning generated type
-     *            builder belongs
-     * @param schemaNode
-     *            schema node which provide data about the schema node name
+     * @param packageName string with the package name to which returning generated type builder belongs
+     * @param schemaNode schema node which provide data about the schema node name
      * @return generated type builder for <code>schemaNode</code>
      */
     private GeneratedTypeBuilder addRawInterfaceDefinition(final ModuleContext context, final SchemaNode schemaNode,
@@ -1721,20 +1607,13 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Returns reference to generated type builder for specified
-     * <code>schemaNode</code> with <code>packageName</code>.
-     *
-     * Firstly the generated type builder is searched in
-     * {@link BindingGeneratorImpl#genTypeBuilders genTypeBuilders}. If it isn't
-     * found it is created and added to <code>genTypeBuilders</code>.
+     * Returns reference to generated type builder for specified <code>schemaNode</code> with <code>packageName</code>.
+     * Firstly the generated type builder is searched in {@link BindingGeneratorImpl#genTypeBuilders genTypeBuilders}.
+     * If it is not found it is created and added to <code>genTypeBuilders</code>.
      *
-     * @param packageName
-     *            string with the package name to which returning generated type
-     *            builder belongs
-     * @param schemaNode
-     *            schema node which provide data about the schema node name
-     * @param prefix
-     *            return type name prefix
+     * @param packageName string with the package name to which returning generated type builder belongs
+     * @param schemaNode schema node which provide data about the schema node name
+     * @param prefix return type name prefix
      * @return generated type builder for <code>schemaNode</code>
      * @throws IllegalArgumentException
      *             <ul>
@@ -1743,7 +1622,6 @@ abstract class AbstractTypeGenerator {
      *             <li>if QName of schema node is null</li>
      *             <li>if schemaNode name is null</li>
      *             </ul>
-     *
      */
     private GeneratedTypeBuilder addRawInterfaceDefinition(final JavaTypeName identifier, final SchemaNode schemaNode) {
         checkArgument(schemaNode != null, "Data Schema Node cannot be NULL.");
@@ -1779,12 +1657,9 @@ abstract class AbstractTypeGenerator {
     /**
      * Creates the name of the getter method name from <code>localName</code>.
      *
-     * @param localName
-     *            string with the name of the getter method
-     * @param returnType
-     *            return type
-     * @return string with the name of the getter method for
-     *         <code>methodName</code> in JAVA method format
+     * @param localName string with the name of the getter method
+     * @param returnType return type
+     * @return string with the name of the getter method for <code>methodName</code> in JAVA method format
      */
     public static String getterMethodName(final String localName, final Type returnType) {
         final StringBuilder method = new StringBuilder();
@@ -1799,10 +1674,9 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Created a method signature builder as part of <code>interfaceBuilder</code>.
-     *
-     * The method signature builder is created for the getter method of <code>schemaNodeName</code>.
-     * Also <code>comment</code> and <code>returnType</code> information are added to the builder.
+     * Created a method signature builder as part of <code>interfaceBuilder</code>. The method signature builder is
+     * created for the getter method of <code>schemaNodeName</code>. Also <code>comment</code>
+     * and <code>returnType</code> information are added to the builder.
      *
      * @param interfaceBuilder generated type builder for which the getter method should be created
      * @param returnType type which represents the return type of the getter method
@@ -1828,23 +1702,16 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Adds <code>schemaNode</code> to <code>typeBuilder</code> as getter method
-     * or to <code>genTOBuilder</code> as property.
+     * Adds <code>schemaNode</code> to <code>typeBuilder</code> as getter method or to <code>genTOBuilder</code>
+     * as a property.
      *
-     * @param basePackageName
-     *            string contains the module package name
-     * @param schemaNode
-     *            data schema node which should be added as getter method to
-     *            <code>typeBuilder</code> or as a property to
-     *            <code>genTOBuilder</code> if is part of the list key
-     * @param typeBuilder
-     *            generated type builder for the list schema node
-     * @param genTOBuilder
-     *            generated TO builder for the list keys
-     * @param listKeys
-     *            list of string which contains names of the list keys
-     * @param module
-     *            current module
+     * @param basePackageName string contains the module package name
+     * @param schemaNode data schema node which should be added as getter method to <code>typeBuilder</code>
+     *                   or as a property to <code>genTOBuilder</code> if is part of the list key
+     * @param typeBuilder generated type builder for the list schema node
+     * @param genTOBuilder generated TO builder for the list keys
+     * @param listKeys list of string which contains names of the list keys
+     * @param module current module
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>schemaNode</code> equals null</li>
@@ -1896,14 +1763,11 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Selects the names of the list keys from <code>list</code> and returns
-     * them as the list of the strings
+     * Selects the names of the list keys from <code>list</code> and returns them as the list of the strings.
      *
-     * @param list
-     *            of string with names of the list keys
-     * @return list of string which represents names of the list keys. If the
-     *         <code>list</code> contains no keys then the empty list is
-     *         returned.
+     * @param list of string with names of the list keys
+     * @return list of string which represents names of the list keys. If the <code>list</code> contains no keys then
+     *         an empty list is returned.
      */
     private static List<String> listKeys(final ListSchemaNode list) {
         final List<String> listKeys = new ArrayList<>();
@@ -1918,16 +1782,12 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Generates for the <code>list</code> which contains any list keys special
-     * generated TO builder.
+     * Generates for the <code>list</code> which contains any list keys special generated TO builder.
      *
-     * @param packageName
-     *            string with package name to which the list belongs
-     * @param list
-     *            list schema node which is source of data about the list name
-     * @return generated TO builder which represents the keys of the
-     *         <code>list</code> or null if <code>list</code> is null or list of
-     *         key definitions is null or empty.
+     * @param packageName string with package name to which the list belongs
+     * @param list list schema node which is source of data about the list name
+     * @return generated TO builder which represents the keys of the <code>list</code> or null if <code>list</code> is
+     *         null or list of key definitions is null or empty.
      */
     private GeneratedTOBuilder resolveListKeyTOBuilder(final ModuleContext context, final ListSchemaNode list) {
         if (list.getKeyDefinition() != null && !list.getKeyDefinition().isEmpty()) {
@@ -1939,22 +1799,14 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Builds a GeneratedTOBuilder for a UnionType {@link UnionTypeDefinition}.
-     *
-     * If more then one generated TO builder is created for enclosing then all
-     * of the generated TO builders are added to <code>typeBuilder</code> as
+     * Builds a GeneratedTOBuilder for a UnionType {@link UnionTypeDefinition}. If more then one generated TO builder
+     * is created for enclosing then all of the generated TO builders are added to <code>typeBuilder</code> as
      * enclosing transfer objects.
      *
-     * @param typeDef
-     *            type definition which can be of type <code>UnionType</code> or
-     *            <code>BitsTypeDefinition</code>
-     * @param typeBuilder
-     *            generated type builder to which is added generated TO created
-     *            from <code>typeDef</code>
-     * @param leaf
-     *            string with name for generated TO builder
-     * @param parentModule
-     *            parent module
+     * @param typeDef type definition which can be of type <code>UnionType</code> or <code>BitsTypeDefinition</code>
+     * @param typeBuilder generated type builder to which is added generated TO created from <code>typeDef</code>
+     * @param leaf string with name for generated TO builder
+     * @param parentModule parent module
      * @return generated TO builder for <code>typeDef</code>
      */
     private Type addTOToTypeBuilder(final UnionTypeDefinition typeDef,
@@ -1980,23 +1832,15 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Builds generated TO builders for <code>typeDef</code> of type {@link BitsTypeDefinition} which are
-     * also added to <code>typeBuilder</code> as enclosing transfer object.
+     * Builds generated TO builders for <code>typeDef</code> of type {@link BitsTypeDefinition} which are also added
+     * to <code>typeBuilder</code> as enclosing transfer object. If more then one generated TO builder is created
+     * for enclosing then all of the generated TO builders are added to <code>typeBuilder</code> as enclosing transfer
+     * objects.
      *
-     * If more then one generated TO builder is created for enclosing then all
-     * of the generated TO builders are added to <code>typeBuilder</code> as
-     * enclosing transfer objects.
-     *
-     * @param typeDef
-     *            type definition which can be of type <code>UnionType</code> or
-     *            <code>BitsTypeDefinition</code>
-     * @param typeBuilder
-     *            generated type builder to which is added generated TO created
-     *            from <code>typeDef</code>
-     * @param leaf
-     *            string with name for generated TO builder
-     * @param parentModule
-     *            parent module
+     * @param typeDef type definition which can be of type <code>UnionType</code> or <code>BitsTypeDefinition</code>
+     * @param typeBuilder generated type builder to which is added generated TO created from <code>typeDef</code>
+     * @param leaf string with name for generated TO builder
+     * @param parentModule parent module
      * @return generated TO builder for <code>typeDef</code>
      */
     private GeneratedTOBuilder addTOToTypeBuilder(final BitsTypeDefinition typeDef,
@@ -2010,19 +1854,13 @@ abstract class AbstractTypeGenerator {
     }
 
     /**
-     * Adds the implemented types to type builder.
-     *
-     * The method passes through the list of <i>uses</i> in
-     * {@code dataNodeContainer}. For every <i>use</i> is obtained corresponding
-     * generated type from {@link ModuleContext#groupings
-     * allGroupings} which is added as <i>implements type</i> to
-     * <code>builder</code>
+     * Adds the implemented types to type builder. The method passes through the list of <i>uses</i> in
+     * {@code dataNodeContainer}. For every <i>use</i> is obtained corresponding generated type
+     * from {@link ModuleContext#groupings allGroupings} which is added as <i>implements type</i>
+     * to <code>builder</code>
      *
-     * @param dataNodeContainer
-     *            element which contains the list of used YANG groupings
-     * @param builder
-     *            builder to which are added implemented types according to
-     *            <code>dataNodeContainer</code>
+     * @param dataNodeContainer element which contains the list of used YANG groupings
+     * @param builder builder to which are added implemented types according to <code>dataNodeContainer</code>
      * @return generated type builder with all implemented types
      */
     private GeneratedTypeBuilder addImplementedInterfaceFromUses(final DataNodeContainer dataNodeContainer,
index b53ec144f6e0d373c54a23ea3c16d9f32bd07b46..4a7818b86494086fe3e801efb796d39548e7c11f 100644 (file)
@@ -32,18 +32,12 @@ public class BindingGeneratorImpl implements BindingGenerator, BindingRuntimeGen
     private static final Logger LOG = LoggerFactory.getLogger(BindingGeneratorImpl.class);
 
     /**
-     * Resolves generated types from <code>context</code> schema nodes only for
-     * modules specified in <code>modules</code>
+     * Resolves generated types from <code>context</code> schema nodes only for modules specified
+     * in <code>modules</code>. 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
-     * @param modules
-     *            set of modules for which schema nodes should be generated
-     *            types
+     * @param context schema context which contains data about all schema nodes saved in modules
+     * @param modules set of modules for which schema nodes should be generated types
      * @return list of types (usually <code>GeneratedType</code> or
      *         <code>GeneratedTransferObject</code>) which:
      *         <ul>
@@ -93,13 +87,13 @@ public class BindingGeneratorImpl implements BindingGenerator, BindingRuntimeGen
         checkState(context.getModules() != null, "Schema Context does not contain defined modules.");
     }
 
-    private static void rename(final Map<SchemaNode, JavaTypeName> renames, final RenameMappingException e) {
-        final JavaTypeName name = e.getName();
-        final SchemaNode def = e.getDefinition();
+    private static void rename(final Map<SchemaNode, JavaTypeName> renames, final RenameMappingException ex) {
+        final JavaTypeName name = ex.getName();
+        final SchemaNode def = ex.getDefinition();
         final JavaTypeName existing = renames.get(def);
         if (existing != null) {
             throw new IllegalStateException("Attempted to relocate " + def + " to " + name + ", already remapped to "
-                    + existing, e);
+                    + existing, ex);
         }
 
         final String suffix;
@@ -110,7 +104,7 @@ public class BindingGeneratorImpl implements BindingGenerator, BindingRuntimeGen
         } else if (def instanceof TypeDefinition) {
             suffix = "$T";
         } else {
-            throw new IllegalStateException("Unhandled remapping of " + def + " at " + name, e);
+            throw new IllegalStateException("Unhandled remapping of " + def + " at " + name, ex);
         }
 
         final JavaTypeName newName = name.createSibling(name.simpleName() + suffix);
index ed840b0b639d46e655e0d44c633fa2f6a94f6358..660f64aef0c54681bf47ce821e725ed14c734d72 100644 (file)
@@ -5,7 +5,6 @@
  * 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.binding.generator.impl;
 
 import com.google.common.base.Preconditions;
@@ -33,8 +32,11 @@ import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.util.SchemaNodeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public final class BindingSchemaContextUtils {
+    private static final Logger LOG = LoggerFactory.getLogger(BindingSchemaContextUtils.class);
 
     private BindingSchemaContextUtils() {
         throw new UnsupportedOperationException("Utility class should not be instantiated");
@@ -53,7 +55,7 @@ public final class BindingSchemaContextUtils {
             currentContainer = findNotification(ctx, currentQName);
         } else if (BindingReflections.isRpcType(currentArg.getType())) {
             currentContainer = findFirstDataNodeContainerInRpc(ctx, currentArg.getType());
-            if(currentQName == null && currentContainer.isPresent()) {
+            if (currentQName == null && currentContainer.isPresent()) {
                 currentQName = ((DataSchemaNode) currentContainer.get()).getQName();
             }
         } else {
@@ -64,13 +66,14 @@ public final class BindingSchemaContextUtils {
             currentArg = pathArguments.next();
             if (Augmentation.class.isAssignableFrom(currentArg.getType())) {
                 currentQName = BindingReflections.findQName(currentArg.getType());
-                if(pathArguments.hasNext()) {
+                if (pathArguments.hasNext()) {
                     currentArg = pathArguments.next();
                 } else {
                     return currentContainer;
                 }
             }
-            if(ChildOf.class.isAssignableFrom(currentArg.getType()) && BindingReflections.isAugmentationChild(currentArg.getType())) {
+            if (ChildOf.class.isAssignableFrom(currentArg.getType())
+                    && BindingReflections.isAugmentationChild(currentArg.getType())) {
                 currentQName = BindingReflections.findQName(currentArg.getType());
             } else {
                 currentQName = BindingReflections.findQName(currentArg.getType()).withModule(currentQName.getModule());
@@ -85,15 +88,6 @@ public final class BindingSchemaContextUtils {
         return currentContainer;
     }
 
-    private static Optional<DataNodeContainer> findNotification(final SchemaContext ctx, final QName notificationQName) {
-        for (NotificationDefinition notification : ctx.getNotifications()) {
-            if (notification.getQName().equals(notificationQName)) {
-                return Optional.<DataNodeContainer> of(notification);
-            }
-        }
-        return Optional.empty();
-    }
-
     private static Optional<DataNodeContainer> findDataNodeContainer(final DataNodeContainer ctx,
             final QName targetQName) {
 
@@ -115,6 +109,16 @@ public final class BindingSchemaContextUtils {
         return Optional.empty();
     }
 
+    private static Optional<DataNodeContainer> findNotification(final SchemaContext ctx,
+            final QName notificationQName) {
+        for (NotificationDefinition notification : ctx.getNotifications()) {
+            if (notification.getQName().equals(notificationQName)) {
+                return Optional.of(notification);
+            }
+        }
+        return Optional.empty();
+    }
+
     private static DataNodeContainer findInCases(final ChoiceSchemaNode choiceNode, final QName targetQName) {
         for (CaseSchemaNode caze : choiceNode.getCases().values()) {
             Optional<DataNodeContainer> potential = findDataNodeContainer(caze, targetQName);
@@ -125,6 +129,7 @@ public final class BindingSchemaContextUtils {
         return null;
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private static Optional<DataNodeContainer> findFirstDataNodeContainerInRpc(final SchemaContext ctx,
             final Class<? extends DataObject> targetType) {
         final QNameModule targetModule;
@@ -156,17 +161,15 @@ public final class BindingSchemaContextUtils {
         if (targetType.equals(rpcOutputName)) {
             return Optional.of(rpc.getOutput());
         }
-       return Optional.empty();
+        return Optional.empty();
     }
 
     public static Set<AugmentationSchemaNode> collectAllAugmentationDefinitions(final SchemaContext currentSchema,
             final AugmentationTarget ctxNode) {
         HashSet<AugmentationSchemaNode> augmentations = new HashSet<>();
         augmentations.addAll(ctxNode.getAvailableAugmentations());
-        if(ctxNode instanceof DataSchemaNode && ((DataSchemaNode) ctxNode).isAddedByUses()) {
-
-            System.out.println(ctxNode);
-
+        if (ctxNode instanceof DataSchemaNode && ((DataSchemaNode) ctxNode).isAddedByUses()) {
+            LOG.info("{}", ctxNode);
         }
 
         return augmentations;
@@ -190,7 +193,7 @@ public final class BindingSchemaContextUtils {
     public static Optional<CaseSchemaNode> findInstantiatedCase(final ChoiceSchemaNode instantiatedChoice,
             final CaseSchemaNode originalDefinition) {
         CaseSchemaNode potential = instantiatedChoice.getCaseNodeByName(originalDefinition.getQName());
-        if(originalDefinition.equals(potential)) {
+        if (originalDefinition.equals(potential)) {
             return Optional.of(potential);
         }
         if (potential != null) {
index 872529db7557bb5b849c190b5e33fbc964406d4f..c938f5e11a93bde45e3f979042bd443f508de791 100644 (file)
@@ -129,39 +129,39 @@ public final class ModuleContext {
         return moduleNode;
     }
 
-    public GeneratedTypeBuilder getChildNode(final SchemaPath p) {
-        return childNodes.get(p);
+    public GeneratedTypeBuilder getChildNode(final SchemaPath path) {
+        return childNodes.get(path);
     }
 
-    public GeneratedTypeBuilder getGrouping(final SchemaPath p) {
-        return groupings.get(p);
+    public GeneratedTypeBuilder getGrouping(final SchemaPath path) {
+        return groupings.get(path);
     }
 
-    public GeneratedTypeBuilder getCase(final SchemaPath p) {
-        return cases.get(p);
+    public GeneratedTypeBuilder getCase(final SchemaPath path) {
+        return cases.get(path);
     }
 
-    public void addModuleNode(final GeneratedTypeBuilder moduleNode) {
-        this.moduleNode = moduleNode;
+    public void addModuleNode(final GeneratedTypeBuilder newModuleNode) {
+        this.moduleNode = newModuleNode;
     }
 
-    public void addGeneratedTOBuilder(final GeneratedTOBuilder b) {
-        genTOs.add(b);
+    public void addGeneratedTOBuilder(final GeneratedTOBuilder builder) {
+        genTOs.add(builder);
     }
 
-    public void addChildNodeType(final SchemaNode def, final GeneratedTypeBuilder b) {
-        checkNamingConflict(def, b.getIdentifier());
-        childNodes.put(def.getPath(), b);
-        typeToSchema.put(b, def);
+    public void addChildNodeType(final SchemaNode def, final GeneratedTypeBuilder builder) {
+        checkNamingConflict(def, builder.getIdentifier());
+        childNodes.put(def.getPath(), builder);
+        typeToSchema.put(builder, def);
     }
 
-    public void addGroupingType(final GroupingDefinition def, final GeneratedTypeBuilder b) {
-        checkNamingConflict(def, b.getIdentifier());
-        groupings.put(def.getPath(), b);
+    public void addGroupingType(final GroupingDefinition def, final GeneratedTypeBuilder builder) {
+        checkNamingConflict(def, builder.getIdentifier());
+        groupings.put(def.getPath(), builder);
     }
 
-    public void addTypedefType(final TypeDefinition<?> def, final Type t) {
-        final JavaTypeName name = t.getIdentifier();
+    public void addTypedefType(final TypeDefinition<?> def, final Type type) {
+        final JavaTypeName name = type.getIdentifier();
         final SchemaNode existingDef = nameMapping.putIfAbsent(name, def);
         if (existingDef != null) {
             if (!(existingDef instanceof TypeDefinition)) {
@@ -172,24 +172,24 @@ public final class ModuleContext {
             LOG.debug("GeneratedType conflict between {} and {} on {}", def, existingDef, name);
         }
 
-        typedefs.put(def.getPath(), t);
+        typedefs.put(def.getPath(), type);
     }
 
-    public void addCaseType(final SchemaPath p, final GeneratedTypeBuilder b) {
-        cases.put(p, b);
+    public void addCaseType(final SchemaPath path, final GeneratedTypeBuilder builder) {
+        cases.put(path, builder);
     }
 
-    public void addIdentityType(final IdentitySchemaNode def, final GeneratedTypeBuilder b) {
-        checkNamingConflict(def, b.getIdentifier());
-        identities.put(def.getQName(), b);
+    public void addIdentityType(final IdentitySchemaNode def, final GeneratedTypeBuilder builder) {
+        checkNamingConflict(def, builder.getIdentifier());
+        identities.put(def.getQName(), builder);
     }
 
-    public void addTopLevelNodeType(final GeneratedTypeBuilder b) {
-        topLevelNodes.add(b);
+    public void addTopLevelNodeType(final GeneratedTypeBuilder builder) {
+        topLevelNodes.add(builder);
     }
 
-    public void addAugmentType(final GeneratedTypeBuilder b) {
-        augmentations.add(b);
+    public void addAugmentType(final GeneratedTypeBuilder builder) {
+        augmentations.add(builder);
     }
 
     public Map<SchemaPath, Type> getTypedefs() {
@@ -240,9 +240,8 @@ public final class ModuleContext {
     }
 
     /**
-     * Returns mapping of type to its schema.
-     *
-     * Valid values are only instances of {@link DataSchemaNode} or {@link AugmentationSchemaNode}
+     * Returns mapping of type to its schema. Valid values are only instances of {@link DataSchemaNode}
+     * or {@link AugmentationSchemaNode}.
      *
      * @return Mapping from type to corresponding schema
      */
@@ -256,9 +255,6 @@ public final class ModuleContext {
 
     /**
      * Adds mapping between schema path and an inner type.
-     *
-     * @param path
-     * @param type
      */
     void addInnerTypedefType(final SchemaPath path, final Type type) {
         innerTypes.put(path, type);
index 7e8bd2e6b292407901def0039b0dfc1aa23857a7..1d112ccb3faa41a956f6cf803997221a1f2a99e6 100644 (file)
@@ -32,7 +32,7 @@ import org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ModuleInfoBackedContext extends GeneratedClassLoadingStrategy
+public final class ModuleInfoBackedContext extends GeneratedClassLoadingStrategy
         implements ModuleInfoRegistry, SchemaContextProvider, SchemaSourceProvider<YangTextSchemaSource> {
 
     private final YangTextSchemaContextResolver ctxResolver = YangTextSchemaContextResolver.create("binding-context");
@@ -89,6 +89,7 @@ public class ModuleInfoBackedContext extends GeneratedClassLoadingStrategy
         return ctxResolver.getSchemaContext();
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private boolean resolveModuleInfo(final Class<?> cls) {
         try {
             return resolveModuleInfo(BindingReflections.getModuleInfo(cls));
@@ -97,6 +98,7 @@ public class ModuleInfoBackedContext extends GeneratedClassLoadingStrategy
         }
     }
 
+    @SuppressWarnings("checkstyle:illegalCatch")
     private boolean resolveModuleInfo(final YangModuleInfo moduleInfo) {
 
         SourceIdentifier identifier = sourceIdentifierFrom(moduleInfo);
@@ -163,7 +165,7 @@ public class ModuleInfoBackedContext extends GeneratedClassLoadingStrategy
 
         private final ModuleInfoBackedContext context;
 
-        public YangModuleInfoRegistration(final YangModuleInfo instance, final ModuleInfoBackedContext context) {
+        YangModuleInfoRegistration(final YangModuleInfo instance, final ModuleInfoBackedContext context) {
             super(instance);
             this.context = context;
         }
index e362c2b0ad256106bb061d326469461c48b05100..cced142c24d5a593394b2b4bc62fec2714aaba45 100644 (file)
@@ -10,11 +10,12 @@ package org.opendaylight.mdsal.binding.generator.impl;
 final class TransformerGeneratorException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
-    public TransformerGeneratorException(final String message, final Throwable cause) {
+    TransformerGeneratorException(final String message, final Throwable cause) {
         super(message, cause);
     }
 
-    public static TransformerGeneratorException wrap(final Class<?> cls, final Throwable cause) throws TransformerGeneratorException {
+    static TransformerGeneratorException wrap(final Class<?> cls, final Throwable cause)
+            throws TransformerGeneratorException {
         return new TransformerGeneratorException(String.format("Failed to generate for type %s", cls), cause);
     }
 }
index 55b8114d5dfe1d4f9f02f07cf0c6921aeb189e46..a2ca55bf24628e0bfc8baf29491a8aca2bf4a80d 100644 (file)
@@ -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;
index 62df6f0b212680898e3e620e743ee5ad2792bd77..a115b953d4a718dd7567ec7d106695dd3de43b22 100644 (file)
@@ -7,26 +7,26 @@
  */
 package org.opendaylight.mdsal.binding.generator.util;
 
-public class CodeGenerationException extends RuntimeException{
+public class CodeGenerationException extends RuntimeException {
     private static final long serialVersionUID = 1L;
 
     public CodeGenerationException() {
     }
 
-    public CodeGenerationException(String message, Throwable cause, boolean enableSuppression,
-            boolean writableStackTrace) {
+    public CodeGenerationException(final String message, final Throwable cause, final boolean enableSuppression,
+            final boolean writableStackTrace) {
         super(message, cause, enableSuppression, writableStackTrace);
     }
 
-    public CodeGenerationException(String message, Throwable cause) {
+    public CodeGenerationException(final String message, final Throwable cause) {
         super(message, cause);
     }
 
-    public CodeGenerationException(String message) {
+    public CodeGenerationException(final String message) {
         super(message);
     }
 
-    public CodeGenerationException(Throwable cause) {
+    public CodeGenerationException(final Throwable cause) {
         super(cause);
     }
 }
index b873eb2624de398bea3a29c2d0240c8b00fd26aa..2e97ecb47607c441d6c2c83b4d151fdddaa40cdf 100644 (file)
@@ -11,13 +11,13 @@ package org.opendaylight.mdsal.binding.generator.util;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import javassist.CtClass;
 import javassist.CtField;
 import javassist.CtMethod;
 import javassist.Modifier;
 import javassist.NotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * The default implementation of the SourceCodeGenerator interface that generates readable source code
@@ -42,17 +42,16 @@ public class DefaultSourceCodeGenerator implements SourceCodeGenerator {
      *     is obtained from a system property (<i>org.opendaylight.yangtools.sal.generatedCodecSourceDir</i>) or
      *     defaults to "generated-codecs".
      */
-    public DefaultSourceCodeGenerator(String generatedSourceDir) {
-        if(generatedSourceDir != null) {
+    public DefaultSourceCodeGenerator(final String generatedSourceDir) {
+        if (generatedSourceDir != null) {
             this.generatedSourceDir = generatedSourceDir;
-        }
-        else {
+        } else {
             this.generatedSourceDir = System.getProperty(GENERATED_SOURCE_DIR_PROP, "generated-codecs");
         }
     }
 
     @Override
-    public void appendField(CtField field, String value) {
+    public void appendField(final CtField field, final String value) {
         try {
             builder.append('\n')
                     .append(Modifier.toString(field.getModifiers()))
@@ -69,7 +68,7 @@ public class DefaultSourceCodeGenerator implements SourceCodeGenerator {
     }
 
     @Override
-    public void appendMethod(CtMethod method, String code) {
+    public void appendMethod(final CtMethod method, final String code) {
         try {
             builder.append('\n')
                     .append(Modifier.toString(method.getModifiers()))
@@ -94,7 +93,7 @@ public class DefaultSourceCodeGenerator implements SourceCodeGenerator {
     }
 
     @Override
-    public void outputGeneratedSource(CtClass ctClass) {
+    public void outputGeneratedSource(final CtClass ctClass) {
         String name = ctClass.getName();
 
         StringBuilder classBuilder = new StringBuilder();
index 8dd1057719d62d3d02ff19f9ee3dcdb4eb53dc24..a2c6456c0159cfa41ebd67ad7ff7e020df5e4d52 100644 (file)
@@ -67,6 +67,7 @@ public final class JavassistUtils {
      * @throws NotFoundException when the prototype class is not found
      */
     @Beta
+    @SuppressWarnings("checkstyle:illegalCatch")
     public synchronized CtClass instantiatePrototype(final String prototype, final String fqn,
             final ClassCustomizer customizer) throws CannotCompileException, NotFoundException {
         final CtClass result = classPool.getAndRename(prototype, fqn);
index e4b26e9095c535d34cb6919228c64e7f8d9fee93..d26006e882c3172e06b37b7c86d18b9b78d9bc8f 100644 (file)
@@ -21,6 +21,7 @@ public class SourceCodeGeneratorFactory {
 
     /**
      * Gets a SourceCodeGenerator instance.
+     *
      * <p>
      * Generation of source code is controlled by the <i>org.opendaylight.yangtools.sal.generateCodecSource</i>
      * system property. If set to true, a DefaultSourceCodeGenerator instance is returned, otherwise a
index 9b9680f17302bfdfc3a7a36c05244afecead006b..5386a77593848be8dea0c6ef27edb942ee0465a6 100644 (file)
@@ -64,8 +64,8 @@ public final class YangSchemaUtils {
     }
 
     public static QName getAugmentationIdentifier(final AugmentationSchemaNode augmentation) {
-        for(final UnknownSchemaNode extension : augmentation.getUnknownSchemaNodes()) {
-            if(AUGMENT_IDENTIFIER.equals(extension.getNodeType().getLocalName())) {
+        for (final UnknownSchemaNode extension : augmentation.getUnknownSchemaNodes()) {
+            if (AUGMENT_IDENTIFIER.equals(extension.getNodeType().getLocalName())) {
                 return extension.getQName();
             }
         }
@@ -78,7 +78,7 @@ public final class YangSchemaUtils {
 
         QName currentArg = arguments.next();
         DataNodeContainer currentNode = context.findModule(currentArg.getModule()).orElse(null);
-        if(currentNode == null) {
+        if (currentNode == null) {
             return null;
         }
         // Last argument is type definition, so we need to cycle until we hit last argument.
index 74a65c8c39e964c3823a626f327fbd91f15be600..0d1ddac048e30a71690e1adc66a0a43e8d526399 100644 (file)
@@ -18,7 +18,6 @@ import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Sets;
 import com.google.common.io.BaseEncoding;
-import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -104,9 +103,6 @@ public abstract class AbstractTypeProvider implements TypeProvider {
      */
     private final SchemaContext schemaContext;
 
-    /**
-     * Map<moduleName, Map<moduleDate, Map<typeName, type>>>
-     */
     private final Map<String, Map<Optional<Revision>, Map<String, Type>>> genTypeDefsContextMap = new HashMap<>();
 
     /**
@@ -119,27 +115,22 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     /**
      * Creates new instance of class <code>TypeProviderImpl</code>.
      *
-     * @param schemaContext
-     *            contains the schema data red from YANG files
-     * @param renames
-     * @throws IllegalArgumentException
-     *             if <code>schemaContext</code> equal null.
+     * @param schemaContext contains the schema data red from YANG files
+     * @param renames renaming table
+     * @throws IllegalArgumentException if <code>schemaContext</code> equal null.
      */
     AbstractTypeProvider(final SchemaContext schemaContext, final Map<SchemaNode, JavaTypeName> renames) {
         Preconditions.checkArgument(schemaContext != null, "Schema Context cannot be null!");
-
         this.schemaContext = schemaContext;
         this.renames = requireNonNull(renames);
         resolveTypeDefsFromContext();
     }
 
     /**
-     * Puts <code>refType</code> to map with key <code>refTypePath</code>
+     * Puts <code>refType</code> to map with key <code>refTypePath</code>.
      *
-     * @param refTypePath
-     *            schema path used as the map key
-     * @param refType
-     *            type which represents the map value
+     * @param refTypePath schema path used as the map key
+     * @param refType type which represents the map value
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>refTypePath</code> equal null</li>
@@ -164,11 +155,9 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Converts schema definition type <code>typeDefinition</code> to JAVA
-     * <code>Type</code>
+     * Converts schema definition type <code>typeDefinition</code> to JAVA <code>Type</code>.
      *
-     * @param typeDefinition
-     *            type definition which is converted to JAVA type
+     * @param typeDefinition type definition which is converted to JAVA type
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>typeDefinition</code> equal null</li>
@@ -178,7 +167,7 @@ public abstract class AbstractTypeProvider implements TypeProvider {
      */
     @Override
     public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> typeDefinition, final SchemaNode parentNode,
-            final Restrictions r) {
+            final Restrictions restrictions) {
         Preconditions.checkArgument(typeDefinition != null, "Type Definition cannot be NULL!");
         Preconditions.checkArgument(typeDefinition.getQName() != null,
                 "Type Definition cannot have non specified QName (QName cannot be NULL!)");
@@ -192,7 +181,7 @@ public abstract class AbstractTypeProvider implements TypeProvider {
             // a base type which holds these constraints.
             if (typeDefinition instanceof DecimalTypeDefinition) {
                 final Type ret = BaseYangTypes.BASE_YANG_TYPES_PROVIDER.javaTypeForSchemaDefinitionType(typeDefinition,
-                    parentNode, r);
+                    parentNode, restrictions);
                 if (ret != null) {
                     return ret;
                 }
@@ -214,7 +203,7 @@ public abstract class AbstractTypeProvider implements TypeProvider {
         }
 
         Type returnType = javaTypeForExtendedType(typeDefinition);
-        if (r != null && returnType instanceof GeneratedTransferObject) {
+        if (restrictions != null && returnType instanceof GeneratedTransferObject) {
             final GeneratedTransferObject gto = (GeneratedTransferObject) returnType;
             final Module module = findParentModule(schemaContext, parentNode);
             final String basePackageName = BindingMapping.getRootPackageName(module.getQNameModule());
@@ -223,19 +212,20 @@ public abstract class AbstractTypeProvider implements TypeProvider {
             final String genTOName = BindingMapping.getClassName(typedefName);
             final String name = packageName + "." + genTOName;
             if (!returnType.getFullyQualifiedName().equals(name)) {
-                returnType = shadedTOWithRestrictions(gto, r);
+                returnType = shadedTOWithRestrictions(gto, restrictions);
             }
         }
         return returnType;
     }
 
-    private GeneratedTransferObject shadedTOWithRestrictions(final GeneratedTransferObject gto, final Restrictions r) {
+    private GeneratedTransferObject shadedTOWithRestrictions(final GeneratedTransferObject gto,
+            final Restrictions restrictions) {
         final GeneratedTOBuilder gtob = newGeneratedTOBuilder(gto.getIdentifier());
         final GeneratedTransferObject parent = gto.getSuperType();
         if (parent != null) {
             gtob.setExtendsType(parent);
         }
-        gtob.setRestrictions(r);
+        gtob.setRestrictions(restrictions);
         for (GeneratedProperty gp : gto.getProperties()) {
             final GeneratedPropertyBuilder gpb = gtob.addProperty(gp.getName());
             gpb.setValue(gp.getValue());
@@ -292,12 +282,10 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Returns JAVA <code>Type</code> for instances of the type
-     * <code>LeafrefTypeDefinition</code> or
+     * Returns JAVA <code>Type</code> for instances of the type <code>LeafrefTypeDefinition</code> or
      * <code>IdentityrefTypeDefinition</code>.
      *
-     * @param typeDefinition
-     *            type definition which is converted to JAVA <code>Type</code>
+     * @param typeDefinition type definition which is converted to JAVA <code>Type</code>
      * @return JAVA <code>Type</code> instance for <code>typeDefinition</code>
      */
     private Type javaTypeForLeafrefOrIdentityRef(final TypeDefinition<?> typeDefinition, final SchemaNode parentNode) {
@@ -314,11 +302,9 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Returns JAVA <code>Type</code> for instances of the type
-     * <code>ExtendedType</code>.
+     * Returns JAVA <code>Type</code> for instances of the type <code>ExtendedType</code>.
      *
-     * @param typeDefinition
-     *            type definition which is converted to JAVA <code>Type</code>
+     * @param typeDefinition type definition which is converted to JAVA <code>Type</code>
      * @return JAVA <code>Type</code> instance for <code>typeDefinition</code>
      */
     private Type javaTypeForExtendedType(final TypeDefinition<?> typeDefinition) {
@@ -350,19 +336,15 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Seeks for identity reference <code>idref</code> the JAVA
-     * <code>type</code>.<br />
-     * <br />
+     * Seeks for identity reference <code>idref</code> the JAVA <code>type</code>.
      *
+     * <p>
      * <i>Example:<br />
      * If identy which is referenced via <code>idref</code> has name <b>Idn</b>
      * then returning type is <b>{@code Class<? extends Idn>}</b></i>
      *
-     * @param idref
-     *            identityref type definition for which JAVA <code>Type</code>
-     *            is sought
-     * @return JAVA <code>Type</code> of the identity which is referenced through
-     *         <code>idref</code>
+     * @param idref identityref type definition for which JAVA <code>Type</code> is sought
+     * @return JAVA <code>Type</code> of the identity which is referenced through <code>idref</code>
      */
     private Type provideTypeForIdentityref(final IdentityrefTypeDefinition idref) {
         final Collection<IdentitySchemaNode> identities = idref.getIdentities();
@@ -381,8 +363,8 @@ public abstract class AbstractTypeProvider implements TypeProvider {
         Preconditions.checkArgument(identity != null, "Target identity '" + baseIdQName + "' do not exists");
 
         final String basePackageName = BindingMapping.getRootPackageName(module.getQNameModule());
-        final JavaTypeName identifier = JavaTypeName.create(BindingGeneratorUtil.packageNameForGeneratedType(basePackageName,
-            identity.getPath()), BindingMapping.getClassName(identity.getQName()));
+        final JavaTypeName identifier = JavaTypeName.create(BindingGeneratorUtil.packageNameForGeneratedType(
+            basePackageName, identity.getPath()), BindingMapping.getClassName(identity.getQName()));
         return Types.classType(Types.wildcardTypeFor(identifier));
     }
 
@@ -401,11 +383,11 @@ public abstract class AbstractTypeProvider implements TypeProvider {
      *             <li>if name of <code>typeDefinition</code></li>
      *             </ul>
      */
-    public Type generatedTypeForExtendedDefinitionType(final TypeDefinition<?> typeDefinition, final SchemaNode parentNode) {
+    public Type generatedTypeForExtendedDefinitionType(final TypeDefinition<?> typeDefinition,
+            final SchemaNode parentNode) {
         Preconditions.checkArgument(typeDefinition != null, "Type Definition cannot be NULL!");
         if (typeDefinition.getQName() == null) {
-            throw new IllegalArgumentException(
-                    "Type Definition cannot have non specified QName (QName cannot be NULL!)");
+            throw new IllegalArgumentException("Type Definition cannot have unspecified QName (QName cannot be NULL!)");
         }
         Preconditions.checkArgument(typeDefinition.getQName().getLocalName() != null,
                 "Type Definitions Local Name cannot be NULL!");
@@ -498,15 +480,11 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Converts <code>leafrefType</code> to JAVA <code>Type</code>.
-     *
-     * The path of <code>leafrefType</code> is followed to find referenced node
-     * and its <code>Type</code> is returned.
+     * Converts <code>leafrefType</code> to JAVA <code>Type</code>. The path of <code>leafrefType</code> is followed
+     * to find referenced node and its <code>Type</code> is returned.
      *
-     * @param leafrefType
-     *            leafref type definition for which is the type sought
-     * @return JAVA <code>Type</code> of data schema node which is referenced in
-     *         <code>leafrefType</code>
+     * @param leafrefType leafref type definition for which is the type sought
+     * @return JAVA <code>Type</code> of data schema node which is referenced in <code>leafrefType</code>
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>leafrefType</code> equal null</li>
@@ -515,14 +493,13 @@ public abstract class AbstractTypeProvider implements TypeProvider {
      *
      */
     public Type provideTypeForLeafref(final LeafrefTypeDefinition leafrefType, final SchemaNode parentNode) {
-        Type returnType = null;
         Preconditions.checkArgument(leafrefType != null, "Leafref Type Definition reference cannot be NULL!");
-
         Preconditions.checkArgument(leafrefType.getPathStatement() != null,
                 "The Path Statement for Leafref Type Definition cannot be NULL!");
 
         final RevisionAwareXPath xpath = leafrefType.getPathStatement();
         final String strXPath = xpath.toString();
+        Type returnType = null;
 
         if (strXPath != null) {
             if (strXPath.indexOf('[') == -1) {
@@ -557,12 +534,10 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Checks if <code>dataNode</code> is <code>LeafSchemaNode</code> and if it
-     * so then checks if it is of type <code>EnumTypeDefinition</code>.
+     * Checks if <code>dataNode</code> is <code>LeafSchemaNode</code> and if it so then checks if it is of type
+     * <code>EnumTypeDefinition</code>.
      *
-     * @param dataNode
-     *            data schema node for which is checked if it is leaf and if it
-     *            is of enum type
+     * @param dataNode data schema node for which is checked if it is leaf and if it is of enum type
      * @return boolean value
      *         <ul>
      *         <li>true - if <code>dataNode</code> is leaf of type enumeration</li>
@@ -580,12 +555,10 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Checks if <code>dataNode</code> is <code>LeafListSchemaNode</code> and if
-     * it so then checks if it is of type <code>EnumTypeDefinition</code>.
+     * Checks if <code>dataNode</code> is <code>LeafListSchemaNode</code> and if it so then checks if it is of type
+     * <code>EnumTypeDefinition</code>.
      *
-     * @param dataNode
-     *            data schema node for which is checked if it is leaflist and if
-     *            it is of enum type
+     * @param dataNode data schema node for which is checked if it is leaflist and if it is of enum type
      * @return boolean value
      *         <ul>
      *         <li>true - if <code>dataNode</code> is leaflist of type
@@ -604,16 +577,11 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Converts <code>enumTypeDef</code> to
-     * {@link Enumeration
-     * enumeration}.
+     * Converts <code>enumTypeDef</code> to {@link Enumeration enumeration}.
      *
-     * @param enumTypeDef
-     *            enumeration type definition which is converted to enumeration
-     * @param enumName
-     *            string with name which is used as the enumeration name
-     * @return enumeration type which is built with data (name, enum values)
-     *         from <code>enumTypeDef</code>
+     * @param enumTypeDef enumeration type definition which is converted to enumeration
+     * @param enumName string with name which is used as the enumeration name
+     * @return enumeration type which is built with data (name, enum values) from <code>enumTypeDef</code>
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>enumTypeDef</code> equals null</li>
@@ -643,18 +611,12 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Adds enumeration to <code>typeBuilder</code>. The enumeration data are
-     * taken from <code>enumTypeDef</code>.
+     * Adds enumeration to <code>typeBuilder</code>. The enumeration data are taken from <code>enumTypeDef</code>.
      *
-     * @param enumTypeDef
-     *            enumeration type definition is source of enumeration data for
-     *            <code>typeBuilder</code>
-     * @param enumName
-     *            string with the name of enumeration
-     * @param typeBuilder
-     *            generated type builder to which is enumeration added
-     * @return enumeration type which contains enumeration data form
-     *         <code>enumTypeDef</code>
+     * @param enumTypeDef enumeration type definition is source of enumeration data for <code>typeBuilder</code>
+     * @param enumName string with the name of enumeration
+     * @param typeBuilder generated type builder to which is enumeration added
+     * @return enumeration type which contains enumeration data form <code>enumTypeDef</code>
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>enumTypeDef</code> equals null</li>
@@ -701,14 +663,12 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     abstract void addCodegenInformation(GeneratedTypeBuilderBase<?> genTOBuilder, TypeDefinition<?> typeDef);
 
     /**
-     * Converts the pattern constraints from <code>typedef</code> to the list of
-     * the strings which represents these constraints.
+     * Converts the pattern constraints from <code>typedef</code> to the list of the strings which represents these
+     * constraints.
      *
-     * @param typedef
-     *            extended type in which are the pattern constraints sought
+     * @param typedef extended type in which are the pattern constraints sought
      * @return list of strings which represents the constraint patterns
-     * @throws IllegalArgumentException
-     *             if <code>typedef</code> equals null
+     * @throws IllegalArgumentException if <code>typedef</code> equals null
      *
      */
     private Map<String, String> resolveRegExpressionsFromTypedef(final TypeDefinition<?> typedef) {
@@ -723,8 +683,7 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     /**
      * Converts <code>dataNode</code> to JAVA <code>Type</code>.
      *
-     * @param dataNode
-     *            contains information about YANG type
+     * @param dataNode contains information about YANG type
      * @return JAVA <code>Type</code> representation of <code>dataNode</code>
      */
     private Type resolveTypeFromDataSchemaNode(final SchemaNode dataNode) {
@@ -743,18 +702,15 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Passes through all modules and through all its type definitions and
-     * convert it to generated types.
+     * Passes through all modules and through all its type definitions and convert it to generated types.
      *
-     * The modules are firstly sorted by mutual dependencies. The modules are
-     * sequentially passed. All type definitions of a module are at the
-     * beginning sorted so that type definition with less amount of references
-     * to other type definition are processed first.<br />
+     * <p>
+     * The modules are first sorted by mutual dependencies. The modules are sequentially passed. All type definitions
+     * of a module are at the beginning sorted so that type definition with less amount of references to other type
+     * definition are processed first.<br>
      * For each module is created mapping record in the map
      * {@link AbstractTypeProvider#genTypeDefsContextMap genTypeDefsContextMap}
-     * which map current module name to the map which maps type names to
-     * returned types (generated types).
-     *
+     * which map current module name to the map which maps type names to returned types (generated types).
      */
     private void resolveTypeDefsFromContext() {
         final Set<Module> modules = schemaContext.getModules();
@@ -782,14 +738,12 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
+     * Create Type for specified type definition.
      *
-     * @param basePackageName
-     *            string with name of package to which the module belongs
-     * @param module
-     *            string with the name of the module for to which the
-     *            <code>typedef</code> belongs
-     * @param typedef
-     *            type definition of the node for which should be created JAVA <code>Type</code> (usually generated TO)
+     * @param basePackageName string with name of package to which the module belongs
+     * @param module string with the name of the module for to which the <code>typedef</code> belongs
+     * @param typedef type definition of the node for which should be created JAVA <code>Type</code>
+     *                (usually generated TO)
      * @return JAVA <code>Type</code> representation of <code>typedef</code> or
      *         <code>null</code> value if <code>basePackageName</code> or
      *         <code>modulName</code> or <code>typedef</code> or Q name of
@@ -832,7 +786,7 @@ public abstract class AbstractTypeProvider implements TypeProvider {
             method.setStatic(true);
             Set<Type> types = additionalTypes.get(module);
             if (types == null) {
-                types = Sets.<Type> newHashSet(unionBuilder.build());
+                types = Sets.newHashSet(unionBuilder.build());
                 additionalTypes.put(module, types);
             } else {
                 types.add(unionBuilder.build());
@@ -874,12 +828,9 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     /**
      * Wraps base YANG type to generated TO.
      *
-     * @param basePackageName
-     *            string with name of package to which the module belongs
-     * @param typedef
-     *            type definition which is converted to the TO
-     * @param javaType
-     *            JAVA <code>Type</code> to which is <code>typedef</code> mapped
+     * @param basePackageName string with name of package to which the module belongs
+     * @param typedef type definition which is converted to the TO
+     * @param javaType JAVA <code>Type</code> to which is <code>typedef</code> mapped
      * @return generated transfer object which represent<code>javaType</code>
      */
     private GeneratedTransferObject wrapJavaTypeIntoTO(final String basePackageName, final TypeDefinition<?> typedef,
@@ -925,14 +876,11 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Converts <code>typedef</code> to generated TO with
-     * <code>typeDefName</code>. Every union type from <code>typedef</code> is
-     * added to generated TO builder as property.
+     * Converts <code>typedef</code> to generated TO with <code>typeDefName</code>. Every union type from
+     * <code>typedef</code> is added to generated TO builder as property.
      *
      * @param typeName new type identifier
-     * @param typedef
-     *            type definition which should be of type
-     *            <code>UnionTypeDefinition</code>
+     * @param typedef type definition which should be of type <code>UnionTypeDefinition</code>
      * @return generated TO builder which represents <code>typedef</code>
      * @throws NullPointerException
      *             <ul>
@@ -989,20 +937,16 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     /**
      * Wraps code which handles the case when union subtype is also of the type <code>UnionType</code>.
      *
+     * <p>
      * In this case the new generated TO is created for union subtype (recursive call of method
      * {@link #provideGeneratedTOBuildersForUnionTypeDef(String, UnionTypeDefinition, String, SchemaNode)}
      * provideGeneratedTOBuilderForUnionTypeDef} and in parent TO builder <code>parentUnionGenTOBuilder</code> is
      * created property which type is equal to new generated TO.
      *
-     * @param parentUnionGenTOBuilder
-     *            generated TO builder to which is the property with the child
-     *            union subtype added
-     * @param basePackageName
-     *            string with the name of the module package
-     * @param unionSubtype
-     *            type definition which represents union subtype
-     * @return list of generated TO builders. The number of the builders can be
-     *         bigger one due to recursive call of
+     * @param parentUnionGenTOBuilder generated TO builder to which is the property with the child union subtype added
+     * @param basePackageName string with the name of the module package
+     * @param unionSubtype type definition which represents union subtype
+     * @return list of generated TO builders. The number of the builders can be bigger one due to recursive call of
      *         <code>provideGeneratedTOBuildersForUnionTypeDef</code> method.
      */
     private List<GeneratedTOBuilder> resolveUnionSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder,
@@ -1023,23 +967,14 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Wraps code which handle case when union subtype is of the type
-     * <code>ExtendedType</code>.
-     *
-     * If TO for this type already exists it is used for the creation of the
-     * property in <code>parentUnionGenTOBuilder</code>. In other case the base
-     * type is used for the property creation.
-     *
-     * @param parentUnionGenTOBuilder
-     *            generated TO builder in which new property is created
-     * @param unionSubtype
-     *            type definition of the <code>ExtendedType</code> type which
-     *            represents union subtype
-     * @param expressions
-     *            list of strings with the regular expressions
-     * @param parentNode
-     *            parent Schema Node for Extended Subtype
+     * Wraps code which handle case when union subtype is of the type <code>ExtendedType</code>. If TO for this type
+     * already exists it is used for the creation of the property in <code>parentUnionGenTOBuilder</code>. Otherwise
+     * the base type is used for the property creation.
      *
+     * @param parentUnionGenTOBuilder generated TO builder in which new property is created
+     * @param unionSubtype type definition of the <code>ExtendedType</code> type which represents union subtype
+     * @param expressions list of strings with the regular expressions
+     * @param parentNode parent Schema Node for Extended Subtype
      */
     private void resolveExtendedSubtypeAsUnion(final GeneratedTOBuilder parentUnionGenTOBuilder,
             final TypeDefinition<?> unionSubtype, final Map<String, String> expressions, final SchemaNode parentNode) {
@@ -1078,18 +1013,17 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Searches for generated TO for <code>searchedTypeDef</code> type
-     * definition in {@link #genTypeDefsContextMap genTypeDefsContextMap}
+     * Searches for generated TO for <code>searchedTypeDef</code> type  definition
+     * in {@link #genTypeDefsContextMap genTypeDefsContextMap}.
      *
-     * @param searchedTypeName
-     *            string with name of <code>searchedTypeDef</code>
-     * @return generated TO for <code>searchedTypeDef</code> or
-     *         <code>null</code> it it doesn't exist
+     * @param searchedTypeName string with name of <code>searchedTypeDef</code>
+     * @return generated TO for <code>searchedTypeDef</code> or <code>null</code> it it doesn't exist
      */
     private Type findGenTO(final String searchedTypeName, final SchemaNode parentNode) {
         final Module typeModule = findParentModule(schemaContext, parentNode);
         if (typeModule != null && typeModule.getName() != null) {
-            final Map<Optional<Revision>, Map<String, Type>> modulesByDate = genTypeDefsContextMap.get(typeModule.getName());
+            final Map<Optional<Revision>, Map<String, Type>> modulesByDate = genTypeDefsContextMap.get(
+                typeModule.getName());
             final Map<String, Type> genTOs = modulesByDate.get(typeModule.getRevision());
             if (genTOs != null) {
                 return genTOs.get(searchedTypeName);
@@ -1099,21 +1033,19 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Stores generated TO created from <code>genTOBuilder</code> for
-     * <code>newTypeDef</code> to {@link #genTypeDefsContextMap
-     * genTypeDefsContextMap} if the module for <code>newTypeDef</code> exists
+     * Stores generated TO created from <code>genTOBuilder</code> for <code>newTypeDef</code>
+     * to {@link #genTypeDefsContextMap genTypeDefsContextMap} if the module for <code>newTypeDef</code> exists.
      *
-     * @param newTypeDef
-     *            type definition for which is <code>genTOBuilder</code> created
-     * @param genTOBuilder
-     *            generated TO builder which is converted to generated TO and
-     *            stored
+     * @param newTypeDef type definition for which is <code>genTOBuilder</code> created
+     * @param genTOBuilder generated TO builder which is converted to generated TO and stored
      */
-    private void storeGenTO(final TypeDefinition<?> newTypeDef, final GeneratedTOBuilder genTOBuilder, final SchemaNode parentNode) {
+    private void storeGenTO(final TypeDefinition<?> newTypeDef, final GeneratedTOBuilder genTOBuilder,
+            final SchemaNode parentNode) {
         if (!(newTypeDef instanceof UnionTypeDefinition)) {
             final Module parentModule = findParentModule(schemaContext, parentNode);
             if (parentModule != null && parentModule.getName() != null) {
-                final Map<Optional<Revision>, Map<String, Type>> modulesByDate = genTypeDefsContextMap.get(parentModule.getName());
+                final Map<Optional<Revision>, Map<String, Type>> modulesByDate = genTypeDefsContextMap.get(
+                    parentModule.getName());
                 final Map<String, Type> genTOsMap = modulesByDate.get(parentModule.getRevision());
                 genTOsMap.put(newTypeDef.getQName().getLocalName(), genTOBuilder.build());
             }
@@ -1121,19 +1053,15 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Adds a new property with the name <code>propertyName</code> and with type
-     * <code>type</code> to <code>unonGenTransObject</code>.
+     * Adds a new property with the name <code>propertyName</code> and with type <code>type</code>
+     * to <code>unonGenTransObject</code>.
      *
-     * @param unionGenTransObject
-     *            generated TO to which should be property added
-     * @param type
-     *            JAVA <code>type</code> of the property which should be added
-     *            to <code>unionGentransObject</code>
-     * @param propertyName
-     *            string with name of property which should be added to
-     *            <code>unionGentransObject</code>
+     * @param unionGenTransObject generated TO to which should be property added
+     * @param type JAVA <code>type</code> of the property which should be added to <code>unionGentransObject</code>
+     * @param propertyName string with name of property which should be added to <code>unionGentransObject</code>
      */
-    private static void updateUnionTypeAsProperty(final GeneratedTOBuilder unionGenTransObject, final Type type, final String propertyName) {
+    private static void updateUnionTypeAsProperty(final GeneratedTOBuilder unionGenTransObject, final Type type,
+            final String propertyName) {
         if (unionGenTransObject != null && type != null && !unionGenTransObject.containsProperty(propertyName)) {
             final GeneratedPropertyBuilder propBuilder = unionGenTransObject
                     .addProperty(BindingMapping.getPropertyName(propertyName));
@@ -1148,12 +1076,9 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     /**
      * Converts <code>typedef</code> to the generated TO builder.
      *
-     * @param basePackageName
-     *            string with name of package to which the module belongs
-     * @param typedef
-     *            type definition from which is the generated TO builder created
-     * @return generated TO builder which contains data from
-     *         <code>typedef</code> and <code>basePackageName</code>
+     * @param basePackageName string with name of package to which the module belongs
+     * @param typedef type definition from which is the generated TO builder created
+     * @return generated TO builder which contains data from <code>typedef</code> and <code>basePackageName</code>
      */
     private GeneratedTOBuilder typedefToTransferObject(final String basePackageName,
             final TypeDefinition<?> typedef, final String moduleName) {
@@ -1172,15 +1097,12 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Converts <code>typeDef</code> which should be of the type
-     * <code>BitsTypeDefinition</code> to <code>GeneratedTOBuilder</code>.
-     *
-     * All the bits of the typeDef are added to returning generated TO as
+     * Converts <code>typeDef</code> which should be of the type <code>BitsTypeDefinition</code>
+     * to <code>GeneratedTOBuilder</code>. All the bits of the typeDef are added to returning generated TO as
      * properties.
      *
      * @param typeName new type identifier
-     * @param typeDef
-     *            type definition from which is the generated TO builder created
+     * @param typeDef type definition from which is the generated TO builder created
      * @return generated TO builder which represents <code>typeDef</code>
      * @throws IllegalArgumentException
      *             <ul>
@@ -1213,15 +1135,11 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
+     * Adds to the <code>genTOBuilder</code> the constant which contains regular expressions from
+     * the <code>regularExpressions</code>.
      *
-     * Adds to the <code>genTOBuilder</code> the constant which contains regular
-     * expressions from the <code>regularExpressions</code>
-     *
-     * @param genTOBuilder
-     *            generated TO builder to which are
-     *            <code>regular expressions</code> added
-     * @param expressions
-     *            list of string which represent regular expressions
+     * @param genTOBuilder generated TO builder to which are <code>regular expressions</code> added
+     * @param expressions list of string which represent regular expressions
      */
     private static void addStringRegExAsConstant(final GeneratedTOBuilder genTOBuilder,
             final Map<String, String> expressions) {
@@ -1232,25 +1150,19 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Creates generated TO with data about inner extended type
-     * <code>innerExtendedType</code>, about the package name
-     * <code>typedefName</code> and about the generated TO name
-     * <code>typedefName</code>.
+     * Creates generated TO with data about inner extended type <code>innerExtendedType</code>, about the package name
+     * <code>typedefName</code> and about the generated TO name <code>typedefName</code>.
      *
-     * It is supposed that <code>innerExtendedType</code> is already present in
-     * {@link AbstractTypeProvider#genTypeDefsContextMap genTypeDefsContextMap} to
-     * be possible set it as extended type for the returning generated TO.
+     * <p>
+     * It is assumed that <code>innerExtendedType</code> is already present in
+     * {@link AbstractTypeProvider#genTypeDefsContextMap genTypeDefsContextMap} to be possible set it as extended type
+     * for the returning generated TO.
      *
-     * @param typedef
-     *            Type Definition
-     * @param innerExtendedType
-     *            extended type which is part of some other extended type
-     * @param basePackageName
-     *            string with the package name of the module
-     * @param moduleName
-     *            Module Name
-     * @return generated TO which extends generated TO for
-     *         <code>innerExtendedType</code>
+     * @param typedef Type Definition
+     * @param innerExtendedType extended type which is part of some other extended type
+     * @param basePackageName string with the package name of the module
+     * @param moduleName Module Name
+     * @return generated TO which extends generated TO for <code>innerExtendedType</code>
      * @throws IllegalArgumentException
      *             <ul>
      *             <li>if <code>extendedType</code> equals null</li>
@@ -1304,11 +1216,10 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Add {@link Serializable} to implemented interfaces of this TO. Also
-     * compute and add serialVersionUID property.
+     * Add {@link java.io.Serializable} to implemented interfaces of this TO. Also compute and add serialVersionUID
+     * property.
      *
-     * @param gto
-     *            transfer object which needs to be serializable
+     * @param gto transfer object which needs to be made serializable
      */
     private static void makeSerializable(final GeneratedTOBuilder gto) {
         gto.addImplementsType(Types.serializableType());
@@ -1318,18 +1229,14 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Finds out for each type definition how many immersion (depth) is
-     * necessary to get to the base type. Every type definition is inserted to
-     * the map which key is depth and value is list of type definitions with
-     * equal depth. In next step are lists from this map concatenated to one
-     * list in ascending order according to their depth. All type definitions
-     * are in the list behind all type definitions on which depends.
+     * Finds out for each type definition how many immersion (depth) is necessary to get to the base type. Every type
+     * definition is inserted to the map which key is depth and value is list of type definitions with equal depth.
+     * In next step are lists from this map concatenated to one list in ascending order according to their depth. All
+     * type definitions are in the list behind all type definitions on which depends.
      *
-     * @param unsortedTypeDefinitions
-     *            list of type definitions which should be sorted by depth
-     * @return list of type definitions sorted according their each other
-     *         dependencies (type definitions which are depend on other type
-     *         definitions are in list behind them).
+     * @param unsortedTypeDefinitions list of type definitions which should be sorted by depth
+     * @return list of type definitions sorted according their each other dependencies (type definitions which are
+     *              dependent on other type definitions are in list behind them).
      */
     private static List<TypeDefinition<?>> sortTypeDefinitionAccordingDepth(
             final Collection<TypeDefinition<?>> unsortedTypeDefinitions) {
@@ -1352,13 +1259,10 @@ public abstract class AbstractTypeProvider implements TypeProvider {
     }
 
     /**
-     * Returns how many immersion is necessary to get from the type definition
-     * to the base type.
+     * Returns how many immersion is necessary to get from the type definition to the base type.
      *
-     * @param typeDefinition
-     *            type definition for which is depth sought.
-     * @return number of immersions which are necessary to get from the type
-     *         definition to the base type
+     * @param typeDefinition type definition for which is depth sought.
+     * @return number of immersions which are necessary to get from the type definition to the base type
      */
     private static int getTypeDefinitionDepth(final TypeDefinition<?> typeDefinition) {
         // FIXME: rewrite this in a non-recursive manner
@@ -1445,7 +1349,8 @@ public abstract class AbstractTypeProvider implements TypeProvider {
                 className = basePackageName + "." + parentName + "." + BindingMapping.getClassName(node.getQName());
             } else {
                 final String basePackageName = BindingMapping.getRootPackageName(parent.getQNameModule());
-                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, type.getPath());
+                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName,
+                    type.getPath());
                 parentName = BindingMapping.getClassName(parent.getName());
                 className = packageName + "." + parentName + "." + BindingMapping.getClassName(node.getQName());
             }
@@ -1465,12 +1370,14 @@ public abstract class AbstractTypeProvider implements TypeProvider {
             if (type.getBaseType() != null) {
                 final Module m = getParentModule(type);
                 final String basePackageName = BindingMapping.getRootPackageName(m.getQNameModule());
-                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, type.getPath());
+                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName,
+                    type.getPath());
                 className = packageName + "." + BindingMapping.getClassName(typeQName);
             } else {
                 final Module parentModule = getParentModule(node);
                 final String basePackageName = BindingMapping.getRootPackageName(parentModule.getQNameModule());
-                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, node.getPath());
+                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName,
+                    node.getPath());
                 className = packageName + "." + BindingMapping.getClassName(node.getQName());
             }
             result = className + "." + newDefVal;
@@ -1521,7 +1428,8 @@ public abstract class AbstractTypeProvider implements TypeProvider {
                 && !(base instanceof EnumTypeDefinition) && !(base instanceof UnionTypeDefinition)) {
             final Module m = getParentModule(type);
             final String basePackageName = BindingMapping.getRootPackageName(m.getQNameModule());
-            final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, type.getPath());
+            final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName,
+                type.getPath());
             final String className = packageName + "." + BindingMapping.getClassName(typeQName);
             sb.insert(0, "new " + className + "(");
             sb.insert(sb.length(), ')');
@@ -1566,7 +1474,8 @@ public abstract class AbstractTypeProvider implements TypeProvider {
 
     private static final Comparator<Bit> BIT_NAME_COMPARATOR = Comparator.comparing(Bit::getName);
 
-    private static String bitsToDef(final BitsTypeDefinition type, final String className, final String defaultValue, final boolean isExt) {
+    private static String bitsToDef(final BitsTypeDefinition type, final String className, final String defaultValue,
+            final boolean isExt) {
         final List<Bit> bits = new ArrayList<>(type.getBits());
         bits.sort(BIT_NAME_COMPARATOR);
         final StringBuilder sb = new StringBuilder();
@@ -1596,7 +1505,8 @@ public abstract class AbstractTypeProvider implements TypeProvider {
         return schemaContext.findModule(qname.getModule()).orElse(null);
     }
 
-    private String leafrefToDef(final LeafSchemaNode parentNode, final LeafrefTypeDefinition leafrefType, final String defaultValue) {
+    private String leafrefToDef(final LeafSchemaNode parentNode, final LeafrefTypeDefinition leafrefType,
+            final String defaultValue) {
         Preconditions.checkArgument(leafrefType != null, "Leafref Type Definition reference cannot be NULL!");
         Preconditions.checkArgument(leafrefType.getPathStatement() != null,
                 "The Path Statement for Leafref Type Definition cannot be NULL!");
@@ -1661,7 +1571,8 @@ public abstract class AbstractTypeProvider implements TypeProvider {
                 parentName = BindingMapping.getClassName(parent.getName()) + "Data";
                 className = basePackageName + "." + parentName + "." + BindingMapping.getClassName(node.getQName());
             } else {
-                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName, UNION_PATH);
+                final String packageName = BindingGeneratorUtil.packageNameForGeneratedType(basePackageName,
+                    UNION_PATH);
                 className = packageName + "." + BindingMapping.getClassName(node.getQName());
             }
         }
index 4aa1c23d2c336eb2fb9f94ae151d306ed9ea0a0a..1b6470aab9f2a8d80348fb30e95b686a907b6114 100644 (file)
@@ -25,71 +25,71 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 
 public final class BaseYangTypes {
     /**
-     * mapping of basic built-in YANG types (keys) to JAVA
-     * {@link org.opendaylight.mdsal.binding.model.api.Type Type}. This
-     * map is filled with mapping data in static initialization block
+     * mapping of basic built-in YANG types (keys) to JAVA {@link org.opendaylight.mdsal.binding.model.api.Type Type}.
+     * This map is filled with mapping data in static initialization block.
      */
     private static final Map<String, Type> TYPE_MAP;
 
     /**
-     * <code>Type</code> representation of <code>boolean</code> YANG type
+     * <code>Type</code> representation of <code>boolean</code> YANG type.
      */
     public static final Type BOOLEAN_TYPE = Types.typeForClass(Boolean.class);
 
     /**
-     * <code>Type</code> representation of <code>empty</code> YANG type
+     * <code>Type</code> representation of <code>empty</code> YANG type.
      */
     public static final Type EMPTY_TYPE = Types.typeForClass(Boolean.class);
 
     public static final Type ENUM_TYPE = Types.typeForClass(Enum.class);
 
     /**
-     * <code>Type</code> representation of <code>int8</code> YANG type
+     * <code>Type</code> representation of <code>int8</code> YANG type.
      */
     public static final Type INT8_TYPE = Types.typeForClass(Byte.class);
 
     /**
-     * <code>Type</code> representation of <code>int16</code> YANG type
+     * <code>Type</code> representation of <code>int16</code> YANG type.
      */
     public static final Type INT16_TYPE = Types.typeForClass(Short.class);
 
     /**
-     * <code>Type</code> representation of <code>int32</code> YANG type
+     * <code>Type</code> representation of <code>int32</code> YANG type.
      */
     public static final Type INT32_TYPE = Types.typeForClass(Integer.class);
 
     /**
-     * <code>Type</code> representation of <code>int64</code> YANG type
+     * <code>Type</code> representation of <code>int64</code> YANG type.
      */
     public static final Type INT64_TYPE = Types.typeForClass(Long.class);
 
     /**
-     * <code>Type</code> representation of <code>string</code> YANG type
+     * <code>Type</code> representation of <code>string</code> YANG type.
      */
     public static final Type STRING_TYPE = Types.typeForClass(String.class);
 
     /**
-     * <code>Type</code> representation of <code>decimal64</code> YANG type
+     * <code>Type</code> representation of <code>decimal64</code> YANG type.
      */
     public static final Type DECIMAL64_TYPE = Types.typeForClass(BigDecimal.class);
 
     /**
-     * <code>Type</code> representation of <code>uint8</code> YANG type
+     * <code>Type</code> representation of <code>uint8</code> YANG type.
      */
-    public static final Type UINT8_TYPE = Types.typeForClass(Short.class, singleRangeRestrictions((short)0, (short)255));
+    public static final Type UINT8_TYPE = Types.typeForClass(Short.class, singleRangeRestrictions((short)0,
+        (short)255));
 
     /**
-     * <code>Type</code> representation of <code>uint16</code> YANG type
+     * <code>Type</code> representation of <code>uint16</code> YANG type.
      */
     public static final Type UINT16_TYPE = Types.typeForClass(Integer.class, singleRangeRestrictions(0, 65535));
 
     /**
-     * <code>Type</code> representation of <code>uint32</code> YANG type
+     * <code>Type</code> representation of <code>uint32</code> YANG type.
      */
     public static final Type UINT32_TYPE = Types.typeForClass(Long.class, singleRangeRestrictions(0L, 4294967295L));
 
     /**
-     * <code>Type</code> representation of <code>uint64</code> YANG type
+     * <code>Type</code> representation of <code>uint64</code> YANG type.
      */
     public static final Type UINT64_TYPE = Types.typeForClass(BigInteger.class,
             singleRangeRestrictions(BigInteger.ZERO, new BigInteger("18446744073709551615")));
@@ -97,7 +97,7 @@ public final class BaseYangTypes {
     public static final Type UNION_TYPE = new UnionType();
 
     /**
-     * <code>Type</code> representation of <code>binary</code> YANG type
+     * <code>Type</code> representation of <code>binary</code> YANG type.
      */
     public static final Type BINARY_TYPE = Types.typeForClass(byte[].class);
 
@@ -171,34 +171,34 @@ public final class BaseYangTypes {
                 final Restrictions restrictions) {
             String typeName = type.getQName().getLocalName();
             switch (typeName) {
-            case "binary":
-                return restrictions == null ? Types.BYTE_ARRAY : Types.typeForClass(byte[].class, restrictions);
-            case "decimal64":
-                return Types.typeForClass(BigDecimal.class, restrictions);
-            case "enumeration":
-                return Types.typeForClass(Enum.class, restrictions);
-            case "int8":
-                return Types.typeForClass(Byte.class, restrictions);
-            case "int16":
-                return Types.typeForClass(Short.class, restrictions);
-            case "int32":
-                return Types.typeForClass(Integer.class, restrictions);
-            case "int64":
-                return Types.typeForClass(Long.class, restrictions);
-            case "string":
-                return Types.typeForClass(String.class, restrictions);
-            case "uint8":
-                return Types.typeForClass(Short.class, restrictions);
-            case "uint16":
-                return Types.typeForClass(Integer.class, restrictions);
-            case "uint32":
-                return Types.typeForClass(Long.class, restrictions);
-            case "uint64":
-                return Types.typeForClass(BigInteger.class, restrictions);
-            case "union" :
-                return UNION_TYPE;
-            default:
-                return javaTypeForSchemaDefinitionType(type, parentNode);
+                case "binary":
+                    return restrictions == null ? Types.BYTE_ARRAY : Types.typeForClass(byte[].class, restrictions);
+                case "decimal64":
+                    return Types.typeForClass(BigDecimal.class, restrictions);
+                case "enumeration":
+                    return Types.typeForClass(Enum.class, restrictions);
+                case "int8":
+                    return Types.typeForClass(Byte.class, restrictions);
+                case "int16":
+                    return Types.typeForClass(Short.class, restrictions);
+                case "int32":
+                    return Types.typeForClass(Integer.class, restrictions);
+                case "int64":
+                    return Types.typeForClass(Long.class, restrictions);
+                case "string":
+                    return Types.typeForClass(String.class, restrictions);
+                case "uint8":
+                    return Types.typeForClass(Short.class, restrictions);
+                case "uint16":
+                    return Types.typeForClass(Integer.class, restrictions);
+                case "uint32":
+                    return Types.typeForClass(Long.class, restrictions);
+                case "uint64":
+                    return Types.typeForClass(BigInteger.class, restrictions);
+                case "union" :
+                    return UNION_TYPE;
+                default:
+                    return javaTypeForSchemaDefinitionType(type, parentNode);
             }
         }
 
index 3401f9a5fe0c20109d5b78ccde964c3f1e1f2601..6f6963f709d3d0bca49fb875c8fd8574d9fe6140 100644 (file)
@@ -48,7 +48,7 @@ public class CodegenTypeProvider extends AbstractTypeProvider {
      * Creates new instance of class <code>TypeProviderImpl</code>.
      *
      * @param schemaContext contains the schema data read from YANG files
-     * @param renames
+     * @param renames renaming table
      * @throws IllegalArgumentException if <code>schemaContext</code> is null.
      */
     public CodegenTypeProvider(final SchemaContext schemaContext, final Map<SchemaNode, JavaTypeName> renames) {
index 29d8e6699c603af079010eb57cb839ce8f0ab029..5344c110a3dcb5b93c4c24dec429224d00f6807d 100644 (file)
@@ -27,15 +27,11 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.UsesNode;
 
 public class GroupingDefinitionDependencySort {
-
     /**
-     * Sorts set <code>groupingDefinitions</code> according to the mutual
-     * dependencies.<br>
-     *
-     * Elements of <code>groupingDefinitions</code> are firstly transformed to
-     * {@link TopologicalSort.Node Node} interfaces and then are sorted by
-     * {@link TopologicalSort#sort(Set) sort()} method of <code>TopologicalSort</code>.<br>
-     * <br>
+     * Sorts set <code>groupingDefinitions</code> according to the mutual dependencies.<br>
+     * Elements of <code>groupingDefinitions</code> are firstly transformed to {@link TopologicalSort.Node Node}
+     * interfaces and then are sorted by {@link TopologicalSort#sort(Set) sort()} method
+     * of <code>TopologicalSort</code>.<br>
      *
      * <i>Definition of dependency relation:<br>
      * The first <code>GroupingDefinition</code> object (in this context)
@@ -44,18 +40,14 @@ public class GroupingDefinitionDependencySort {
      * {@link org.opendaylight.yangtools.yang.model.api.DataNodeContainer#getUses()
      * getUses} method) reference to the second one.</i>
      *
-     * @param groupingDefinitions
-     *            set of grouping definition which should be sorted according to
-     *            mutual dependencies
-     * @return list of grouping definitiond which are sorted by mutual
-     *         dependencies
-     * @throws IllegalArgumentException
-     *             if <code>groupingDefinitions</code>
+     * @param groupingDefinitions set of grouping definition which should be sorted according to mutual dependencies
+     * @return list of grouping definitiond which are sorted by mutual dependencies
+     * @throws IllegalArgumentException if <code>groupingDefinitions</code>
      *
      */
     public List<GroupingDefinition> sort(final Collection<GroupingDefinition> groupingDefinitions) {
         if (groupingDefinitions == null) {
-            throw new IllegalArgumentException("Set of Type Definitions " + "cannot be NULL!");
+            throw new IllegalArgumentException("Set of Type Definitions cannot be NULL!");
         }
 
         final List<GroupingDefinition> resultGroupingDefinitions = new ArrayList<>();
@@ -66,25 +58,16 @@ public class GroupingDefinitionDependencySort {
             resultGroupingDefinitions.add((GroupingDefinition) nodeWrappedType.getWrappedType());
         }
         return resultGroupingDefinitions;
-
     }
 
     /**
-     * Wraps every grouping definition to node type and adds to every node
-     * information about dependencies.
-     *
-     * The map with mapping from schema path (represents grouping definition) to
-     * node is created. For every created node (next <i>nodeFrom</i>) is for its
-     * wrapped grouping definition passed the set of its <i>uses nodes</i>
-     * through. For every uses node is found its wrapping node (next as
-     * <i>nodeTo</i>). This dependency relationship between nodeFrom and all
-     * found nodesTo is modeled with creating of one edge from nodeFrom to
-     * nodeTo.
-     *
-     *
-     * @param groupingDefinitions
-     *            set of goruping definition which will be wrapped to nodes
+     * Wraps every grouping definition to node type and adds to every node information about dependencies. The map
+     * with mapping from schema path (represents grouping definition) to node is created. For every created node
+     * (next <i>nodeFrom</i>) is for its wrapped grouping definition passed the set of its <i>uses nodes</i> through.
+     * For every uses node is found its wrapping node (next as <i>nodeTo</i>). This dependency relationship between
+     * nodeFrom and all found nodesTo is modeled with creating of one edge from nodeFrom to nodeTo.
      *
+     * @param groupingDefinitions set of goruping definition which will be wrapped to nodes
      * @return set of nodes where every one contains wrapped grouping definition
      */
     private Set<Node> groupingDefinitionsToNodes(final Collection<GroupingDefinition> groupingDefinitions) {
@@ -118,13 +101,10 @@ public class GroupingDefinitionDependencySort {
     }
 
     /**
-     * Returns the set of the uses nodes which are get from uses in
-     * <code>container</code>, from uses in groupings inside
-     * <code>container</code> and from uses inside child nodes of the
-     * <code>container</code>.
+     * Returns the set of the uses nodes which are get from uses in <code>container</code>, from uses in groupings
+     * inside <code>container</code> and from uses inside child nodes of the <code>container</code>.
      *
-     * @param container
-     *            data node container which can contain some uses of grouping
+     * @param container data node container which can contain some uses of grouping
      * @return set of uses nodes which were find in <code>container</code>.
      */
     private Set<UsesNode> getAllUsesNodes(final DataNodeContainer container) {
index e0f2f64471c289b4ffc51fb4affd302310256750..14dcd27af983b909c0be01a9d917db4a677a406f 100644 (file)
@@ -11,23 +11,22 @@ import org.opendaylight.yangtools.util.TopologicalSort.NodeImpl;
 
 public final class NodeWrappedType extends NodeImpl {
     /**
-     * The payload which is saved inside Node
+     * The payload which is saved inside Node.
      */
     private final Object wrappedType;
 
     /**
      * Create new instance of class <code>NodeWrappedType</code>.
-     * 
-     * @param wrappedType
-     *            object with payload data
+     *
+     * @param wrappedType object with payload data
      */
-    NodeWrappedType(Object wrappedType) {
+    NodeWrappedType(final Object wrappedType) {
         this.wrappedType = wrappedType;
     }
 
     /**
-     * Gets payload from class
-     * 
+     * Gets payload from class.
+     *
      * @return object with <code>wrappedType</code>
      */
     Object getWrappedType() {
@@ -35,14 +34,14 @@ public final class NodeWrappedType extends NodeImpl {
     }
 
     @Override
-    public boolean equals(Object o) {
-        if (this == o) {
+    public boolean equals(final Object obj) {
+        if (this == obj) {
             return true;
         }
-        if (!(o instanceof NodeWrappedType)) {
+        if (!(obj instanceof NodeWrappedType)) {
             return false;
         }
-        NodeWrappedType nodeWrappedType = (NodeWrappedType) o;
+        NodeWrappedType nodeWrappedType = (NodeWrappedType) obj;
         if (!wrappedType.equals(nodeWrappedType.wrappedType)) {
             return false;
         }
@@ -58,5 +57,4 @@ public final class NodeWrappedType extends NodeImpl {
     public String toString() {
         return "NodeWrappedType{" + "wrappedType=" + wrappedType + '}';
     }
-
 }
index 38e997c3526fb0631aa342555d1803655d582bf3..660cf4cccefc4dfe94a2a10cbe2868200b61c79c 100644 (file)
@@ -30,7 +30,7 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
     }
 
     @Test
-    public void AugmentationWithRelativeXPathTest() {
+    public void testAugmentationWithRelativeXPath() {
 
         final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
 
@@ -47,15 +47,17 @@ public class AugmentRelativeXPathTest extends AbstractTypesTest {
         GeneratedTransferObject gtTunnelKey = null;
 
         for (final Type type : genTypes) {
-            if (type.getName().equals("InterfaceKey") && type.getPackageName().contains("augment._abstract.topology")) {
+            if (!type.getPackageName().contains("augment._abstract.topology")) {
+                continue;
+            }
+
+            if (type.getName().equals("InterfaceKey")) {
                 gtInterfaceKey = (GeneratedTransferObject) type;
-            } else if (type.getName().equals("Interface")
-                    && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("Interface")) {
                 gtInterface = (GeneratedType) type;
-            } else if (type.getName().equals("Tunnel") && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("Tunnel")) {
                 gtTunnel = (GeneratedType) type;
-            } else if (type.getName().equals("TunnelKey")
-                    && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("TunnelKey")) {
                 gtTunnelKey = (GeneratedTransferObject) type;
             }
         }
index 7cfecf88bfb9f55872f2a160a4f539886db07572..aeb4ef56ca18336014b2a7d89ab22721c9543a7f 100644 (file)
@@ -48,18 +48,19 @@ public class AugmentedTypeTest {
         GeneratedType gtNetworkLink2 = null;
 
         for (final Type type : genTypes) {
-            if (type.getName().equals("InterfaceKey") && type.getPackageName().contains("augment._abstract.topology")) {
+            if (!type.getPackageName().contains("augment._abstract.topology")) {
+                continue;
+            }
+
+            if (type.getName().equals("InterfaceKey")) {
                 gtInterfaceKey = (GeneratedTransferObject) type;
-            } else if (type.getName().equals("Interface")
-                    && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("Interface")) {
                 gtInterface = (GeneratedType) type;
-            } else if (type.getName().equals("Tunnel") && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("Tunnel")) {
                 gtTunnel = (GeneratedType) type;
-            } else if (type.getName().equals("TunnelKey")
-                    && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("TunnelKey")) {
                 gtTunnelKey = (GeneratedTransferObject) type;
-            } else if (type.getName().equals("NetworkLink2")
-                    && type.getPackageName().contains("augment._abstract.topology")) {
+            } else if (type.getName().equals("NetworkLink2")) {
                 gtNetworkLink2 = (GeneratedType) type;
             }
         }
index 18c747a6c00c81f98202e1db007ee0be8acc4a3b..c3a55b03493d659e6fb73b641b82fb12c7c4cc96 100644 (file)
@@ -23,23 +23,22 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class BinaryTypeTest {
-    private final static List<File> yangModels = new ArrayList<>();
-    private final static URL yangModelsFolder = AugmentedTypeTest.class
-            .getResource("/binary-type-test-models");
+    private static final List<File> YANG_MODELS = new ArrayList<>();
+    private static final URL YANG_MODELS_FOLDER = AugmentedTypeTest.class.getResource("/binary-type-test-models");
 
     @BeforeClass
     public static void loadTestResources() throws URISyntaxException {
-        final File augFolder = new File(yangModelsFolder.toURI());
+        final File augFolder = new File(YANG_MODELS_FOLDER.toURI());
         for (final File fileEntry : augFolder.listFiles()) {
             if (fileEntry.isFile()) {
-                yangModels.add(fileEntry);
+                YANG_MODELS.add(fileEntry);
             }
         }
     }
 
     @Test
     public void binaryTypeTest() {
-        final SchemaContext context = YangParserTestUtils.parseYangFiles(yangModels);
+        final SchemaContext context = YangParserTestUtils.parseYangFiles(YANG_MODELS);
 
         assertNotNull("context is null", context);
         final BindingGenerator bindingGen = new BindingGeneratorImpl();
index 20467e5b3183ef89a67ab9b30ae12b68a44533c9..f50a7b02ee2b042df40dddc987631f99bff684fe 100644 (file)
@@ -48,24 +48,26 @@ public class BindingGeneratorImplTest {
 
         for (Type type : generateTypes) {
             switch (type.getName()) {
-            case "ChoiceTestData":
-                choiceTestData = (GeneratedType) type;
-                break;
-            case "Myrootcontainer":
-                myRootContainer = (GeneratedType) type;
-                break;
-            case "Mylist":
-                myList = (GeneratedType) type;
-                break;
-            case "Mylist2":
-                myList2 = (GeneratedType) type;
-                break;
-            case "Mycontainer":
-                myContainer = (GeneratedType) type;
-                break;
-            case "Mycontainer2":
-                myContainer2 = (GeneratedType) type;
-                break;
+                case "ChoiceTestData":
+                    choiceTestData = (GeneratedType) type;
+                    break;
+                case "Myrootcontainer":
+                    myRootContainer = (GeneratedType) type;
+                    break;
+                case "Mylist":
+                    myList = (GeneratedType) type;
+                    break;
+                case "Mylist2":
+                    myList2 = (GeneratedType) type;
+                    break;
+                case "Mycontainer":
+                    myContainer = (GeneratedType) type;
+                    break;
+                case "Mycontainer2":
+                    myContainer2 = (GeneratedType) type;
+                    break;
+                default:
+                    // ignore
             }
         }
 
@@ -146,12 +148,14 @@ public class BindingGeneratorImplTest {
         List<Type> impl = foo.getImplements();
         for (Type type : impl) {
             switch (type.getName()) {
-            case "ChildOf":
-                childOf = type;
-                break;
-            case "DataObject":
-                dataObject = type;
-                break;
+                case "ChildOf":
+                    childOf = type;
+                    break;
+                case "DataObject":
+                    dataObject = type;
+                    break;
+                default:
+                    // ignore
             }
         }
 
index a4f1665941853d7bb3bd2538e4ec9f4014bb7493..f31db1fa067c0ff191e6162ce45f99b04ef8966c 100644 (file)
@@ -161,7 +161,8 @@ public class BitAndUnionTOEnclosingTest {
         assertEquals("TypeUnion$1 has incorrect package name.",
                 "org.opendaylight.yang.gen.v1.urn.bit.union.in.leaf.rev130626", typeUnion1.getPackageName());
 
-        assertEquals("TypeUnion1 generated TO has incorrect number of properties", 4, typeUnion1.getProperties().size());
+        assertEquals("TypeUnion1 generated TO has incorrect number of properties", 4,
+            typeUnion1.getProperties().size());
 
         containsAttributes(typeUnion1, true, true, true, new NameTypePattern("uint32", "Long"));
         containsAttributes(typeUnion1, true, true, true, new NameTypePattern("int8", "Byte"));
@@ -174,7 +175,8 @@ public class BitAndUnionTOEnclosingTest {
         assertEquals("TypeUnion$2 has incorrect package name.",
                 "org.opendaylight.yang.gen.v1.urn.bit.union.in.leaf.rev130626", typeUnion2.getPackageName());
 
-        assertEquals("TypeUnion2 generated TO has incorrect number of properties", 2, typeUnion2.getProperties().size());
+        assertEquals("TypeUnion2 generated TO has incorrect number of properties", 2,
+            typeUnion2.getProperties().size());
         containsAttributes(typeUnion2, true, true, true, new NameTypePattern("string", "String"));
         containsAttributes(typeUnion2, true, true, true, new NameTypePattern("uint64", "BigInteger"));
 
index b35aa6fa0b7eb81eee883520438ce904340427b5..b1fd5bc1b7a71150ffa1e632ac3c62f4816e9b25 100644 (file)
@@ -65,7 +65,8 @@ public class ChoiceCaseGenTypesTest extends AbstractTypesTest {
         assertFalse("genTypes is empty", genTypes.isEmpty());
 
         // test for file choice-monitoring
-        String pcgPref = "org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.choice.monitoring.rev130701.netconf.state.datastores.datastore.locks";
+        String pcgPref = "org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.choice.monitoring.rev130701."
+                + "netconf.state.datastores.datastore.locks";
         GeneratedType genType = null;
 
         checkGeneratedType(genTypes, "LockType", pcgPref); // choice
@@ -153,20 +154,22 @@ public class ChoiceCaseGenTypesTest extends AbstractTypesTest {
         containsMethods(genType, new NameTypePattern("getStorageFormat", "StorageFormat"));
         containsInterface("Augmentation<Datastore>", genType);
 
-        genType = checkGeneratedType(genTypes, "StorageFormat", pcgPref + ".netconf.state.datastores.datastore"); // choice
+        // choice
+        genType = checkGeneratedType(genTypes, "StorageFormat", pcgPref + ".netconf.state.datastores.datastore");
 
         genType = checkGeneratedType(genTypes, "UnknownFiles", pcgPref
                 + ".netconf.state.datastores.datastore.storage.format"); // case
         containsMethods(genType, new NameTypePattern("getFiles", "List<Files>"));
         containsInterface("StorageFormat", genType);
 
-        genType = checkGeneratedType(genTypes, "Xml", pcgPref + ".netconf.state.datastores.datastore.storage.format"); // case
+        // case
+        genType = checkGeneratedType(genTypes, "Xml", pcgPref + ".netconf.state.datastores.datastore.storage.format");
         containsMethods(genType, new NameTypePattern("getXmlDef", "XmlDef"));
         containsInterface("StorageFormat", genType);
 
-        genType = checkGeneratedType(genTypes, "Yang", pcgPref + ".netconf.state.datastores.datastore.storage.format"); // case
+        // case
+        genType = checkGeneratedType(genTypes, "Yang", pcgPref + ".netconf.state.datastores.datastore.storage.format");
         containsMethods(genType, new NameTypePattern("getYangFileName", "String"));
         containsInterface("StorageFormat", genType);
-
     }
 }
index aefc3f386aabe42ea0ca25a81e3e2368e2a6014b..5e16092dd6174984f85435c0206e9a745c0bec5d 100644 (file)
@@ -8,6 +8,8 @@
 package org.opendaylight.mdsal.binding.generator.impl;
 
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 
 import java.lang.reflect.Constructor;
@@ -19,18 +21,19 @@ import org.opendaylight.yangtools.yang.binding.Identifier;
 public class CodecTypeUtilsTest {
 
     @Test
-    public void newIdentifiableItem() throws Exception {
+    public void newIdentifiableItem() {
         assertNotNull(CodecTypeUtils.newIdentifiableItem(Identifiable.class, mock(Identifier.class)));
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void privateConstructTest() throws Throwable {
+    @Test
+    public void privateConstructTest() throws NoSuchMethodException, ReflectiveOperationException {
         final Constructor<?> constructor = CodecTypeUtils.class.getDeclaredConstructor();
         constructor.setAccessible(true);
         try {
             constructor.newInstance();
+            fail();
         } catch (InvocationTargetException e) {
-            throw e.getCause();
+            assertTrue(e.getCause() instanceof UnsupportedOperationException);
         }
     }
 }
\ No newline at end of file
index c2069720e6ffb2f74470191d64602f7e383b214c..94dc87f77895956f1717f2e0db52f420d937df73 100644 (file)
@@ -53,17 +53,17 @@ public class GeneratedTypesStringTest {
                         } else {
                             break;
                         }
-                        ParameterizedType pType;
+                        ParameterizedType paramType;
                         if (con.getType() instanceof ParameterizedType) {
-                            pType = (ParameterizedType) con.getType();
+                            paramType = (ParameterizedType) con.getType();
                         } else {
                             break;
                         }
 
                         Type[] types;
-                        if (pType.getName().equals("List")) {
+                        if (paramType.getName().equals("List")) {
                             constantRegExListTypeContainer = true;
-                            types = pType.getActualTypeArguments();
+                            types = paramType.getActualTypeArguments();
                         } else {
                             break;
                         }
index 755e92f5a3dd5584dbf211c2fdd1016e5c0fd3d0..7e51d54183ccce5e665d53ac0a0a438ad7f9fc8e 100644 (file)
@@ -47,9 +47,8 @@ public class IdentityrefTypeTest {
     }
 
     /**
-     * Test mainly for the method
-     * TypeProviderImpl#provideTypeForIdentityref(IdentityrefTypeDefinition)
-     * provideTypeForIdentityref}
+     * Test mainly for the method TypeProviderImpl#provideTypeForIdentityref(IdentityrefTypeDefinition)
+     * provideTypeForIdentityref}.
      */
     @Test
     public void testIdentityrefYangBuiltInType() {
@@ -85,11 +84,9 @@ public class IdentityrefTypeTest {
                 }
             }
         }
-        assertNotNull("The method 'getLf' wasn't found", typeName);
+        assertNotNull("The method 'getLf' was not found", typeName);
         assertEquals("Return type has incorrect name", "Class", typeName);
         assertEquals("Incorrect number of type parameters", 1, numOfActualTypes);
         assertEquals("Return type has incorrect actual parameter", "SomeIdentity", actualTypeName);
-
     }
-
 }
index 94b0ebb0391ecb4da4a56e2b5376e4213a6bdd8e..ef897e5217374b4ab5a9b293f6eb0c4ab595e4de 100644 (file)
@@ -18,7 +18,10 @@ import org.opendaylight.mdsal.binding.model.api.MethodSignature;
 import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
 import org.opendaylight.mdsal.binding.model.api.Type;
 
-public class SupportTestUtil {
+public final class SupportTestUtil {
+    private SupportTestUtil() {
+
+    }
 
     public static void containsMethods(final GeneratedType genType, final NameTypePattern... searchedSignsWhat) {
         final List<MethodSignature> searchedSignsIn = genType.getMethodDefinitions();
@@ -53,8 +56,8 @@ public class SupportTestUtil {
         }
     }
 
-    public static void containsAttributes(final GeneratedTransferObject genTO, boolean equal, boolean hash,
-            boolean toString, final NameTypePattern... searchedSignsWhat) {
+    public static void containsAttributes(final GeneratedTransferObject genTO, final boolean equal, final boolean hash,
+            final boolean toString, final NameTypePattern... searchedSignsWhat) {
         List<GeneratedProperty> searchedPropertiesIn = genTO.getProperties();
         containsAttributes(searchedPropertiesIn, "", searchedSignsWhat);
         if (equal) {
@@ -113,7 +116,7 @@ public class SupportTestUtil {
         return nameBuilder.toString();
     }
 
-    public static void containsInterface(String interfaceNameSearched, GeneratedType genType) {
+    public static void containsInterface(final String interfaceNameSearched, final GeneratedType genType) {
         List<Type> caseCImplements = genType.getImplements();
         boolean interfaceFound = false;
         for (Type caseCImplement : caseCImplements) {
index 991d476467bfa47f3bd58f91e8f63b72dda51dab..c40acf5ed8b6a2e129472064d6a495465e4a6e76 100644 (file)
@@ -12,6 +12,7 @@ import static org.junit.Assert.assertNotNull;
 
 import com.google.common.collect.ImmutableMap;
 import java.util.Set;
+import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -27,264 +28,270 @@ import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 public class TypeProviderIntegrationTest {
-    private final String PKG = "org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev131008.";
-    private static SchemaContext context;
+    private static final String PKG = "org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev131008.";
+    private static SchemaContext CONTEXT;
     private AbstractTypeProvider provider;
-    private Module m;
+    private Module module;
 
     @BeforeClass
     public static void setup() {
-        context = YangParserTestUtils.parseYangResources(TypeProviderIntegrationTest.class, "/type-provider/test.yang",
+        CONTEXT = YangParserTestUtils.parseYangResources(TypeProviderIntegrationTest.class, "/type-provider/test.yang",
             "/ietf/ietf-inet-types.yang");
-        assertNotNull(context);
+        assertNotNull(CONTEXT);
+    }
+
+    @AfterClass
+    public static void teardown() {
+        CONTEXT = null;
     }
 
     @Before
     public void init() {
-        provider = new CodegenTypeProvider(context, ImmutableMap.of());
-        m = context.findModule("test", Revision.of("2013-10-08")).get();
+        provider = new CodegenTypeProvider(CONTEXT, ImmutableMap.of());
+        module = CONTEXT.findModule("test", Revision.of("2013-10-08")).get();
     }
 
     @Test
     public void testGetTypeDefaultConstructionBinary() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-binary");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-binary");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new byte[] {77, 97, 110}", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-binary");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-binary");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyBinary(new byte[] {77, 97, 110})", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionBits() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-bits");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-bits");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "TestData.LeafBits(false, false, true)", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-bits");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-bits");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyBits(false, false, true)", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionBoolean() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-boolean");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-boolean");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Boolean.TRUE", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-boolean");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-boolean");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyBoolean(java.lang.Boolean.TRUE)", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionDecimal() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-decimal64");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-decimal64");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new java.math.BigDecimal(\"3.14\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-decimal64");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-decimal64");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyDecimal64(new java.math.BigDecimal(\"3.14\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionEmpty() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-empty");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-empty");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Boolean.FALSE", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-empty");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-empty");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyEmpty(java.lang.Boolean.FALSE)", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionEnumeration() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-enumeration");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-enumeration");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.test.rev131008.LeafEnumeration.Seven", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-enumeration");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-enumeration");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals(PKG + "MyEnumeration.Seven", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionInt8() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-int8");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-int8");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Byte.valueOf(\"11\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-int8");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-int8");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyInt8(java.lang.Byte.valueOf(\"11\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionInt16() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-int16");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-int16");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Short.valueOf(\"111\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-int16");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-int16");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyInt16(java.lang.Short.valueOf(\"111\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionInt32() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-int32");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-int32");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Integer.valueOf(\"1111\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-int32");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-int32");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyInt32(java.lang.Integer.valueOf(\"1111\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionInt64() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-int64");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-int64");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Long.valueOf(\"11111\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-int64");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-int64");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyInt64(java.lang.Long.valueOf(\"11111\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionLeafref1() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-leafref");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-leafref");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new java.math.BigDecimal(\"1.234\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-leafref");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-leafref");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new java.math.BigDecimal(\"1.234\")", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionLeafref2() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-leafref1");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-leafref1");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyBinary(new byte[] {77, 97, 110})", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-leafref1");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-leafref1");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyBinary(new byte[] {77, 97, 110})", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionString() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-string");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-string");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("\"name\"", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-string");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-string");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyString(\"name\")", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionUint8() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-uint8");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-uint8");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Short.valueOf(\"11\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-uint8");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-uint8");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyUint8(java.lang.Short.valueOf(\"11\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionUint16() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-uint16");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-uint16");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Integer.valueOf(\"111\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-uint16");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-uint16");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyUint16(java.lang.Integer.valueOf(\"111\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionUint32() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-uint32");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-uint32");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("java.lang.Long.valueOf(\"1111\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-uint32");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-uint32");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyUint32(java.lang.Long.valueOf(\"1111\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionUint64() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-uint64");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-uint64");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new java.math.BigInteger(\"11111\")", actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-uint64");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-uint64");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         assertEquals("new " + PKG + "MyUint64(new java.math.BigInteger(\"11111\"))", actual);
     }
 
     @Test
     public void testGetTypeDefaultConstruction() {
-        final QName leafNode = QName.create(m.getQNameModule(), "ip-leaf");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode);
+        final QName leafNode = QName.create(module.getQNameModule(), "ip-leaf");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode);
         String actual = provider.getTypeDefaultConstruction(leaf);
-        String exp = "new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address(\"0.0.0.1\")";
+        String exp = "new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924."
+                + "Ipv4Address(\"0.0.0.1\")";
         assertEquals(exp, actual);
     }
 
     @Test
     public void testGetTypeDefaultConstructionUnion() {
-        final QName leafNode1 = QName.create(m.getQNameModule(), "leaf-union");
-        LeafSchemaNode leaf = (LeafSchemaNode) m.getDataChildByName(leafNode1);
+        final QName leafNode1 = QName.create(module.getQNameModule(), "leaf-union");
+        LeafSchemaNode leaf = (LeafSchemaNode) module.getDataChildByName(leafNode1);
         String actual = provider.getTypeDefaultConstruction(leaf);
         String expected = "new " + PKG + "TestData.LeafUnion(\"111\".toCharArray())";
         assertEquals(expected, actual);
 
-        final QName leafNode2 = QName.create(m.getQNameModule(), "ext-union");
-        leaf = (LeafSchemaNode) m.getDataChildByName(leafNode2);
+        final QName leafNode2 = QName.create(module.getQNameModule(), "ext-union");
+        leaf = (LeafSchemaNode) module.getDataChildByName(leafNode2);
         actual = provider.getTypeDefaultConstruction(leaf);
         expected = "new " + PKG + "MyUnion(\"111\".toCharArray())";
         assertEquals(expected, actual);
@@ -292,13 +299,13 @@ public class TypeProviderIntegrationTest {
 
     @Test
     public void testGetTypeDefaultConstructionUnionNested()  {
-        final QName containerNode1 = QName.create(m.getQNameModule(), "c1");
-        ContainerSchemaNode c1 = (ContainerSchemaNode) m.getDataChildByName(containerNode1);
-        final QName containerNode2 = QName.create(m.getQNameModule(), "c2");
+        final QName containerNode1 = QName.create(module.getQNameModule(), "c1");
+        ContainerSchemaNode c1 = (ContainerSchemaNode) module.getDataChildByName(containerNode1);
+        final QName containerNode2 = QName.create(module.getQNameModule(), "c2");
         ContainerSchemaNode c2 = (ContainerSchemaNode) c1.getDataChildByName(containerNode2);
-        final QName containerNode3 = QName.create(m.getQNameModule(), "c3");
+        final QName containerNode3 = QName.create(module.getQNameModule(), "c3");
         ContainerSchemaNode c3 = (ContainerSchemaNode) c2.getDataChildByName(containerNode3);
-        final QName leafNode = QName.create(m.getQNameModule(), "id");
+        final QName leafNode = QName.create(module.getQNameModule(), "id");
         LeafSchemaNode leaf = (LeafSchemaNode) c3.getDataChildByName(leafNode);
 
         String actual = provider.getTypeDefaultConstruction(leaf);
@@ -308,8 +315,8 @@ public class TypeProviderIntegrationTest {
 
     @Test
     public void testGetParamNameFromType() {
-        m = context.findModule("ietf-inet-types", Revision.of("2010-09-24")).get();
-        Set<TypeDefinition<?>> types = m.getTypeDefinitions();
+        module = CONTEXT.findModule("ietf-inet-types", Revision.of("2010-09-24")).get();
+        Set<TypeDefinition<?>> types = module.getTypeDefinitions();
         TypeDefinition<?> ipv4 = null;
         TypeDefinition<?> ipv6 = null;
         TypeDefinition<?> ipv4Pref = null;
index cc20cc55c9fca28c64eeecb3092593af7f277adf..9030c20eea045bd809506b25e8411e8e2f071f87 100644 (file)
@@ -55,6 +55,8 @@ public class UnionTypeDefTest {
                         case "stringRefValue":
                             assertEquals(Types.STRING, generatedProperty.getReturnType());
                             break;
+                        default:
+                            // ignore
                     }
                 }
             }
index e6b1ac9676348357f6e6dece7efaa2997da60875..cc110159700c3e6e8635c6b3ae0891539c6ac874 100644 (file)
@@ -401,22 +401,22 @@ public class UsesTest {
             }
         }
 
-        assertNotNull("Generated type for RPC test input wasn't generated", rpcTestInput);
+        assertNotNull("Generated type for RPC test input was not generated", rpcTestInput);
         assertEquals("RpcTestInput interface - incorrect number of occurences", 1, rpcTestInputCounter);
-        assertEquals("RpcTestInput isn't in correct package", "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev130718",
-                rpcTestInput.getPackageName());
+        assertEquals("RpcTestInput is not in correct package",
+            "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev130718", rpcTestInput.getPackageName());
 
-        assertNotNull("Generated type for RPC test output wasn't generated", rpcTestOutput);
+        assertNotNull("Generated type for RPC test output was not generated", rpcTestOutput);
         assertEquals("RpcTestOutput interface - incorrect number of occurences", 1, rpcTestOutputCounter);
-        assertEquals("RpcTestOutput isn't in correct package",
+        assertEquals("RpcTestOutput is not in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev130718", rpcTestOutput.getPackageName());
 
-        assertNotNull("Generated type for grouping-rpc-input-test wasn't generated", groupingRpcInputTest);
+        assertNotNull("Generated type for grouping-rpc-input-test was not generated", groupingRpcInputTest);
         assertEquals("RpcTestOutput interface - incorrect number of occurences", 1, groupingRpcInputTestCounter);
         assertEquals("GroupingRpcInputTest isn't in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev130718", groupingRpcInputTest.getPackageName());
 
-        assertNotNull("Generated type for grouping-rpc-output-test wasn't generated", groupingRpcOutputTest);
+        assertNotNull("Generated type for grouping-rpc-output-test was not generated", groupingRpcOutputTest);
         assertEquals("RpcTestOutput interface - incorrect number of occurences", 1, groupingRpcOutputTestCounter);
         assertEquals("GroupingRpcOutputTest isn't in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev130718", groupingRpcOutputTest.getPackageName());
@@ -425,7 +425,7 @@ public class UsesTest {
                 containerGroupingRpcInputTest);
         assertEquals("ContainerGroupingRpcInputTest interface - incorrect number of occurences", 1,
                 containerGroupingRpcInputTestCounter);
-        assertEquals("ContainerGroupingRpcInputTest isn't in correct package",
+        assertEquals("ContainerGroupingRpcInputTest is not in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev130718.grouping.rpc.input.test",
                 containerGroupingRpcInputTest.getPackageName());
 
index facdb2a8ec47f4f43930cd2ad0f2ab4d7384901c..d499cea1eae8296d4a87c4d04440233d1900bf47 100644 (file)
@@ -7,21 +7,24 @@
  */
 package org.opendaylight.mdsal.binding.generator.impl;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import org.junit.Test;
 import org.opendaylight.mdsal.binding.model.util.FormattingUtils;
 
 public class YangTextTemplateTest {
-
-    @Test(expected = UnsupportedOperationException.class)
-    public void privateConstructTest() throws Throwable {
+    @Test
+    public void privateConstructTest() throws ReflectiveOperationException  {
         final Constructor<FormattingUtils> constructor = FormattingUtils.class.getDeclaredConstructor();
         constructor.setAccessible(true);
         try {
             constructor.newInstance();
+            fail();
         } catch (InvocationTargetException e) {
-            throw e.getCause();
+            assertTrue(e.getCause() instanceof UnsupportedOperationException);
         }
     }
 }
\ No newline at end of file
index 7590bad700daef8e6dbd18c75c6b917caf804ed0..9f3a17bc6d23f502cc020a8c00f2fe4958678680 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.mdsal.binding.generator.util;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -94,22 +96,21 @@ public class YangSchemaUtilsTest {
         final TypeDefinition<?> typeDefinition = mock(TypeDefinition.class);
         doReturn(Q_NAME).when(typeDefinition).getQName();
         doReturn(ImmutableSet.of(typeDefinition)).when(container).getTypeDefinitions();
-        assertEquals(typeDefinition,
-                YangSchemaUtils.findTypeDefinition(context, SchemaPath.create(ImmutableList.of(Q_NAME), false)));
+        assertEquals(typeDefinition, YangSchemaUtils.findTypeDefinition(context, SchemaPath.create(false, Q_NAME)));
 
         final GroupingDefinition grouping = mock(GroupingDefinition.class);
         doReturn(Q_NAME).when(grouping).getQName();
         doReturn(ImmutableSet.of(grouping)).when(container).getGroupings();
         doReturn(ImmutableSet.of(typeDefinition)).when(grouping).getTypeDefinitions();
-        assertEquals(typeDefinition,
-                YangSchemaUtils.findTypeDefinition(context, SchemaPath.create(ImmutableList.of(Q_NAME, Q_NAME), false)));
+        assertEquals(typeDefinition, YangSchemaUtils.findTypeDefinition(context,
+            SchemaPath.create(false, Q_NAME, Q_NAME)));
 
         final DataNodeContainer dataNode =
                 mock(DataNodeContainer.class, withSettings().extraInterfaces(DataSchemaNode.class));
         doReturn(dataNode).when(container).getDataChildByName((QName) any());
         doReturn(ImmutableSet.of(typeDefinition)).when(dataNode).getTypeDefinitions();
-        assertEquals(typeDefinition,
-                YangSchemaUtils.findTypeDefinition(context, SchemaPath.create(ImmutableList.of(Q_NAME, Q_NAME), false)));
+        assertEquals(typeDefinition, YangSchemaUtils.findTypeDefinition(context,
+            SchemaPath.create(false, Q_NAME, Q_NAME)));
 
         final ChoiceSchemaNode choiceNode =
                 mock(ChoiceSchemaNode.class, withSettings().extraInterfaces(DataSchemaNode.class));
@@ -117,19 +118,19 @@ public class YangSchemaUtilsTest {
         final CaseSchemaNode caseNode = mock(CaseSchemaNode.class);
         doReturn(caseNode).when(choiceNode).getCaseNodeByName((QName) any());
         doReturn(ImmutableSet.of(typeDefinition)).when(caseNode).getTypeDefinitions();
-        assertEquals(typeDefinition,
-                YangSchemaUtils.findTypeDefinition(context,
-                        SchemaPath.create(ImmutableList.of(Q_NAME, Q_NAME, Q_NAME), false)));
+        assertEquals(typeDefinition, YangSchemaUtils.findTypeDefinition(context,
+            SchemaPath.create(false, Q_NAME, Q_NAME, Q_NAME)));
     }
 
-    @Test(expected = UnsupportedOperationException.class)
-    public void privateConstructTest() throws Throwable {
+    @Test
+    public void privateConstructTest() throws ReflectiveOperationException {
         final Constructor<YangSchemaUtils> constructor = YangSchemaUtils.class.getDeclaredConstructor();
         constructor.setAccessible(true);
         try {
             constructor.newInstance();
+            fail();
         } catch (InvocationTargetException e) {
-            throw e.getCause();
+            assertTrue(e.getCause() instanceof UnsupportedOperationException);
         }
     }
 }
index 748f873ea29eae90257c9fc6e24612e632ccf733..70a07764421c5134c86a9be713db690566ea0f03 100644 (file)
@@ -28,8 +28,9 @@ public class GroupingDefinitionDependencySortTest {
 
     @Test
     public void testSortMethod() {
-        GroupingDefinitionDependencySort groupingDefinitionDependencySort = new GroupingDefinitionDependencySort();
-        List<GroupingDefinition> unsortedGroupingDefs = new ArrayList<>();
+        final GroupingDefinitionDependencySort groupingDefinitionDependencySort =
+                new GroupingDefinitionDependencySort();
+        final List<GroupingDefinition> unsortedGroupingDefs = new ArrayList<>();
 
         GroupingDefinition grp1 = mock(GroupingDefinition.class);
         doReturn(SchemaPath.create(false, QName.create("", "Cont1"), QName.create("", "Cont2"))).when(grp1).getPath();
index 238b3508794476d148db3f8ddc73ef006b9ca9c5..105b804dd10f5bbe0b2a201159ede5dfddb3c107 100644 (file)
@@ -18,12 +18,9 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
 
 /**
- * Mock LeafrefDypeDefinition implementation with non-null referenced RevisionAwareXPath.
- *
- * Although RevisionAwareXPath has implemented Override for toString to return null value to reach specific branch
+ * Mock LeafrefDypeDefinition implementation with non-null referenced RevisionAwareXPath. Although RevisionAwareXPath
+ * has implemented Override for toString to return null value to reach specific branch
  * in TypeProviderImpl#provideTypeForLeafref method.
- *
- * Created by lukas on 9/17/14.
  */
 public class LeafrefTypeWithNullToStringInXpath implements LeafrefTypeDefinition {
     @Override
index 2fb962d6104dd482586dd493fda7f5add2cdc092..83cbabec352152a519254f4d256218705e943f07 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
 
 /**
- * Mock LeafrefDypeDefinition implementation with RevisionAwareXPath null reference
+ * Mock LeafrefDypeDefinition implementation with RevisionAwareXPath null reference.
  *
  * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
  */
index 5c6e29f8e8c550d725de697faee87a4672731050..4dca2438c3c463590e8467e41e238a74abab2c02 100644 (file)
@@ -12,16 +12,15 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
-import org.opendaylight.mdsal.binding.yang.types.NodeWrappedType;
 
 public class NodeWrappedTypeTest {
 
     @Test
     public void test() {
-        NodeWrappedType nwt1 = new NodeWrappedType("obj1");
-        NodeWrappedType nwt2 = new NodeWrappedType("obj2");
-        NodeWrappedType nwt3 = new NodeWrappedType("obj1");
-        String str = "obj3";
+        final NodeWrappedType nwt1 = new NodeWrappedType("obj1");
+        final NodeWrappedType nwt2 = new NodeWrappedType("obj2");
+        final NodeWrappedType nwt3 = new NodeWrappedType("obj1");
+        final String str = "obj3";
 
         assertTrue("Node nwt1 should equal to itself.", nwt1.equals(nwt1));
         assertFalse("It can't be possible to compare nwt with string.", nwt1.equals(str));
index 0a7a397f549985976b4ee781d58356e39dbc56d1..ac4a0a5a16ee17914e04cce1ef8f6f713bf43f8f 100644 (file)
@@ -188,8 +188,8 @@ public class TypeProviderImplTest {
         try {
             assertEquals("\"default value\"", typeProvider.getTypeDefaultConstruction(leafSchemaNode, "default value"));
             fail("Expected NoSuchElementException");
-        } catch (Exception e) {
-            assertTrue(e instanceof NoSuchElementException);
+        } catch (NoSuchElementException e) {
+            // Okay
         }
 
         // identityref type
@@ -206,8 +206,7 @@ public class TypeProviderImplTest {
         try {
             assertEquals("\"default value\"", typeProvider.getTypeDefaultConstruction(leafSchemaNode, "default value"));
             fail("Expected UnsupportedOperationException");
-        } catch (Exception e) {
-            assertTrue(e instanceof UnsupportedOperationException);
+        } catch (UnsupportedOperationException e) {
             assertEquals("Cannot get default construction for identityref type", e.getMessage());
         }
     }
index 3c273db93269a8c22fc9505ac236d53cf9b43369..be53d691fc0224622b44acff931f84055cf5ed8d 100644 (file)
@@ -11,13 +11,15 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
 /**
- * Test Model Provider designated to load test resources and provide Schema Context
- * for testing of TypeProviderImpl
+ * Test Model Provider designated to load test resources and provide Schema Context for testing of TypeProviderImpl.
  */
 public final class TypeProviderModel {
-
     public static final String TEST_TYPE_PROVIDER_MODULE_NAME = "test-type-provider";
 
+    private TypeProviderModel() {
+
+    }
+
     public static SchemaContext createTestContext() {
         return YangParserTestUtils.parseYangResources(TypeProviderModel.class, "/base-yang-types.yang",
             "/" + TEST_TYPE_PROVIDER_MODULE_NAME + ".yang", "/test-type-provider-b.yang");
index 00e5d60e575e87048c5a789d61aae06be8fad032..1a0c80993b3c852bb4330834c6dee5a7da767f40 100644 (file)
@@ -51,10 +51,9 @@ import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
 
 /**
- * Test suite for testing public methods in TypeProviderImpl class
- *
- * @see org.opendaylight.mdsal.binding.yang.types.TypeProviderImpl
+ * Test suite for testing public methods in TypeProviderImpl class.
  *
+ * @see org.opendaylight.mdsal.binding.yang.types.AbstractTypeProvider
  * @author Lukas Sedlak &lt;lsedlak@cisco.com&gt;
  */
 @RunWith(MockitoJUnitRunner.class)
@@ -233,9 +232,7 @@ public class TypeProviderTest {
         return result;
     }
 
-    /**
-     * FIXME: Remove @Ignore annotation once the bug https://bugs.opendaylight.org/show_bug.cgi?id=1862 is fixed
-     */
+    // FIXME: Remove @Ignore annotation once the bug https://bugs.opendaylight.org/show_bug.cgi?id=1862 is fixed
     @Ignore
     @Test
     public void bug1862RestrictedTypedefTransformationTest() {
@@ -621,7 +618,8 @@ public class TypeProviderTest {
         final AbstractTypeProvider provider = new RuntimeTypeProvider(SCHEMA_CONTEXT);
 
         final Module baseYangTypes = resolveModule("test-type-provider");
-        final TypeDefinition<?> barItemLeafrefId = resolveTypeDefinitionFromModule(baseYangTypes, "bar-item-leafref-id");
+        final TypeDefinition<?> barItemLeafrefId = resolveTypeDefinitionFromModule(baseYangTypes,
+            "bar-item-leafref-id");
         assertNotNull(barItemLeafrefId);
         final Type extType = provider.generatedTypeForExtendedDefinitionType(barItemLeafrefId, barItemLeafrefId);
         assertEquals(null, extType);
@@ -735,137 +733,137 @@ public class TypeProviderTest {
         String result = provider.getTypeDefaultConstruction(leaf, "true");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangBoolean(java.lang.Boolean.TRUE)",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangBoolean(java.lang.Boolean.TRUE)", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-empty");
         result = provider.getTypeDefaultConstruction(leaf, "true");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangEmpty(java.lang.Boolean.TRUE)",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangEmpty(java.lang.Boolean.TRUE)", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-enumeration");
         result = provider.getTypeDefaultConstruction(leaf, "a");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangEnumeration.A",
-            result);
+        assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangEnumeration.A", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("direct-use-of-enum");
         result = provider.getTypeDefaultConstruction(leaf, "y");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912.construction.type.test.DirectUseOfEnum.Y",
-            result);
+        assertEquals("org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912."
+                + "construction.type.test.DirectUseOfEnum.Y", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-int8");
         result = provider.getTypeDefaultConstruction(leaf, "17");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangInt8(java.lang.Byte.valueOf(\"17\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangInt8(java.lang.Byte.valueOf(\"17\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-int8-restricted");
         result = provider.getTypeDefaultConstruction(leaf, "99");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangInt8Restricted(java.lang.Byte.valueOf(\"99\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangInt8Restricted(java.lang.Byte.valueOf(\"99\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-int16");
         result = provider.getTypeDefaultConstruction(leaf, "1024");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangInt16(java.lang.Short.valueOf(\"1024\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangInt16(java.lang.Short.valueOf(\"1024\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-int32");
         result = provider.getTypeDefaultConstruction(leaf, "1048576");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangInt32(java.lang.Integer.valueOf(\"1048576\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangInt32(java.lang.Integer.valueOf(\"1048576\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-int64");
         result = provider.getTypeDefaultConstruction(leaf, "1099511627776");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangInt64(java.lang.Long.valueOf(\"1099511627776\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangInt64(java.lang.Long.valueOf(\"1099511627776\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-string");
         result = provider.getTypeDefaultConstruction(leaf, "TEST");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangString(\"TEST\")",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangString(\"TEST\")", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-decimal64");
         result = provider.getTypeDefaultConstruction(leaf, "1274.25");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangDecimal64(new java.math.BigDecimal(\"1274.25\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangDecimal64(new java.math.BigDecimal(\"1274.25\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-uint8");
         result = provider.getTypeDefaultConstruction(leaf, "128");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangUint8(java.lang.Short.valueOf(\"128\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangUint8(java.lang.Short.valueOf(\"128\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-uint16");
         result = provider.getTypeDefaultConstruction(leaf, "1048576");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangUint16(java.lang.Integer.valueOf(\"1048576\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangUint16(java.lang.Integer.valueOf(\"1048576\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-uint32");
         result = provider.getTypeDefaultConstruction(leaf, "1099511627776");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangUint32(java.lang.Long.valueOf(\"1099511627776\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangUint32(java.lang.Long.valueOf(\"1099511627776\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-uint64");
         result = provider.getTypeDefaultConstruction(leaf, "1208925819614629174706176");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangUint64(new java.math.BigInteger(\"1208925819614629174706176\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangUint64(new java.math.BigInteger(\"1208925819614629174706176\"))", result);
 
         //FIXME: Is this correct scenario and correct result?
         leaf = provideLeafForGetDefaultConstructionTestCase("complex-union");
         result = provider.getTypeDefaultConstruction(leaf, "75");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912.ComplexUnion(\"null\".toCharArray())",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912."
+                + "ComplexUnion(\"null\".toCharArray())", result);
 
         //FIXME: Is this correct scenario and correct result?
         leaf = provideLeafForGetDefaultConstructionTestCase("complex-string-int-union");
         result = provider.getTypeDefaultConstruction(leaf, "TEST_UNION_STRING_DEFAULT");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912.ComplexStringIntUnion(\"null\".toCharArray())",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912."
+                + "ComplexStringIntUnion(\"null\".toCharArray())", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("simple-int-types-union");
         result = provider.getTypeDefaultConstruction(leaf, "2048");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangUnion(\"null\".toCharArray())",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangUnion(\"null\".toCharArray())", result);
 
 
         leaf = provideLeafForGetDefaultConstructionTestCase("direct-union-leaf");
         result = provider.getTypeDefaultConstruction(leaf);
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912.DirectUnionLeaf(\"128\".toCharArray())",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912."
+                + "DirectUnionLeaf(\"128\".toCharArray())", result);
 
         final Module module = resolveModule("test-type-provider");
         final QName leafUnionNode = QName.create(module.getQNameModule(), "root-union-leaf");
@@ -876,15 +874,15 @@ public class TypeProviderTest {
         result = provider.getTypeDefaultConstruction(leaf);
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912.TestTypeProviderData.RootUnionLeaf(\"256\".toCharArray())",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912."
+                + "TestTypeProviderData.RootUnionLeaf(\"256\".toCharArray())", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-binary");
         result = provider.getTypeDefaultConstruction(leaf, "0xffffff");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangBinary(new byte[] {-45, 23, -33, 125, -9, -33})",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangBinary(new byte[] {-45, 23, -33, 125, -9, -33})", result);
 
         final QName leafBitsNode = QName.create(module.getQNameModule(), "root-bits-leaf");
         rootNode = module.getDataChildByName(leafBitsNode);
@@ -894,35 +892,34 @@ public class TypeProviderTest {
         result = provider.getTypeDefaultConstruction(leaf);
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912.TestTypeProviderData.RootBitsLeaf(true, false, false)",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.type.provider.model.rev140912."
+                + "TestTypeProviderData.RootBitsLeaf(true, false, false)", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("yang-bits");
         result = provider.getTypeDefaultConstruction(leaf, "only-10-Mb");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangBits(false, false, true)",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangBits(false, false, true)", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("bar-id");
         result = provider.getTypeDefaultConstruction(leaf, "128");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangInt16(java.lang.Short.valueOf(\"128\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangInt16(java.lang.Short.valueOf(\"128\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("foo-leafref-value");
         result = provider.getTypeDefaultConstruction(leaf, "32");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914.YangInt8(java.lang.Byte.valueOf(\"32\"))",
-            result);
+        assertEquals("new org.opendaylight.yang.gen.v1.urn.opendaylight.org.test.base.yang.types.rev140914."
+                + "YangInt8(java.lang.Byte.valueOf(\"32\"))", result);
 
         leaf = provideLeafForGetDefaultConstructionTestCase("foo-cond-bar-item");
         result = provider.getTypeDefaultConstruction(leaf, "10");
         assertNotNull(result);
         assertTrue(!result.isEmpty());
-        assertEquals("new java.lang.Object()",
-            result);
+        assertEquals("new java.lang.Object()", result);
     }
 }