Merge "Moved parsing of unknown nodes from implementation to abstract classes."
authorAlessandro Boch <aboch@cisco.com>
Fri, 12 Jul 2013 00:09:45 +0000 (00:09 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 12 Jul 2013 00:09:45 +0000 (00:09 +0000)
40 files changed:
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/AbstractDataNodeContainerBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/AbstractSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/AbstractTypeAwareBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/AugmentationSchemaBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/Builder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/ConfigNode.java [deleted file]
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/DataNodeContainerBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/DataSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/GroupingBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/GroupingMember.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/SchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/TypeAwareBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/TypeDefinitionBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AnyXmlBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ChoiceBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ChoiceCaseBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ConstraintsBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ContainerSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/DeviationBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ExtensionBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/FeatureBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/GroupingBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/IdentitySchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/IdentityrefTypeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/LeafListSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/LeafSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ListSchemaNodeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/ModuleBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/NotificationBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/TypeDefinitionBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/UnionTypeBuilder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/UsesNodeBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/impl/YangParserListenerImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserListenerUtils.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/ParserUtils.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/RefineHolder.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/util/RefineUtils.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/java/org/opendaylight/controller/yang/parser/impl/TypesResolutionTest.java

index 091bfc7..df85c5c 100644 (file)
@@ -7,15 +7,22 @@
  */
 package org.opendaylight.controller.yang.parser.builder.api;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import org.opendaylight.controller.yang.common.QName;
 import org.opendaylight.controller.yang.model.api.DataSchemaNode;
 import org.opendaylight.controller.yang.model.api.GroupingDefinition;
+import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.util.YangParseException;
 
+/**
+ * Basic implementation of DataNodeContainerBuilder.
+ */
 public abstract class AbstractDataNodeContainerBuilder implements DataNodeContainerBuilder {
     protected final int line;
     protected final QName qname;
@@ -27,6 +34,9 @@ public abstract class AbstractDataNodeContainerBuilder implements DataNodeContai
     protected Set<GroupingDefinition> groupings;
     protected final Set<GroupingBuilder> addedGroupings = new HashSet<GroupingBuilder>();
 
+    protected List<UnknownSchemaNode> unknownNodes;
+    protected final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
+
     protected AbstractDataNodeContainerBuilder(final int line, final QName qname) {
         this.line = line;
         this.qname = qname;
@@ -115,4 +125,18 @@ public abstract class AbstractDataNodeContainerBuilder implements DataNodeContai
         addedGroupings.add(groupingBuilder);
     }
 
+    @Override
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
+        return addedUnknownNodes;
+    }
+
+    @Override
+    public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {
+        addedUnknownNodes.add(unknownNode);
+    }
+
+    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
+        this.unknownNodes = unknownNodes;
+    }
+
 }
index 8659cac..a786cd9 100644 (file)
@@ -97,7 +97,12 @@ public abstract class AbstractSchemaNodeBuilder implements SchemaNodeBuilder {
     }\r
 \r
     @Override\r
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {\r
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {\r
+        return addedUnknownNodes;\r
+    }\r
+\r
+    @Override\r
+    public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {\r
         addedUnknownNodes.add(unknownNode);\r
     }\r
 \r
index caf71ec..3e8dc6c 100644 (file)
@@ -7,8 +7,13 @@
  */
 package org.opendaylight.controller.yang.parser.builder.api;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.opendaylight.controller.yang.common.QName;
 import org.opendaylight.controller.yang.model.api.TypeDefinition;
+import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
+import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
 
 /**
  * Basic implementation for TypeAwareBuilder builders.
@@ -19,6 +24,8 @@ public abstract class AbstractTypeAwareBuilder implements TypeAwareBuilder {
     protected Builder parent;
     protected TypeDefinition<?> type;
     protected TypeDefinitionBuilder typedef;
+    protected List<UnknownSchemaNode> unknownNodes;
+    protected final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     public AbstractTypeAwareBuilder(final int line, final QName qname) {
         this.line = line;
@@ -67,4 +74,18 @@ public abstract class AbstractTypeAwareBuilder implements TypeAwareBuilder {
         this.type = null;
     }
 
+    @Override
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
+        return addedUnknownNodes;
+    }
+
+    @Override
+    public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {
+        addedUnknownNodes.add(unknownNode);
+    }
+
+    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
+        this.unknownNodes = unknownNodes;
+    }
+
 }
index 4500b13..eb23eab 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.controller.yang.parser.builder.api;
 
+import java.util.List;
+
 import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
 
 /**
@@ -36,6 +38,20 @@ public interface Builder {
      */
     void setParent(Builder parent);
 
+    /**
+     * Add unknown node to this builder.
+     *
+     * @param unknownNode
+     */
+    void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode);
+
+    /**
+     * Get builders of unknown nodes defined in this node.
+     *
+     * @return collection of UnknownSchemaNodeBuilder objects
+     */
+    List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders();
+
     /**
      * Build YANG data model node.
      *
@@ -47,6 +63,4 @@ public interface Builder {
      */
     Object build();
 
-    void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode);
-
 }
diff --git a/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/ConfigNode.java b/opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/api/ConfigNode.java
deleted file mode 100644 (file)
index 85f6b07..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * 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.controller.yang.parser.builder.api;
-
-/**
- * Interface for all nodes which can have 'config' statement.
- * [container, leaf, leaf-list, list, choice, anyxml, deviate]
- *
- */
-public interface ConfigNode {
-
-    Boolean isConfiguration();
-
-    void setConfiguration(Boolean config);
-
-}
index 4271776..7a5f80d 100644 (file)
@@ -20,28 +20,90 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
  */
 public interface DataNodeContainerBuilder extends Builder {
 
+    /**
+     * Get qname of this node.
+     *
+     * @return QName of this node
+     */
     QName getQName();
 
+    /**
+     * Get schema path of this node.
+     *
+     * @return SchemaPath of this node
+     */
     SchemaPath getPath();
 
+    /**
+     * Get already built child nodes.
+     *
+     * @return collection of child nodes
+     */
     Set<DataSchemaNode> getChildNodes();
 
+    /**
+     * Get builders of child nodes.
+     *
+     * @return collection child nodes builders
+     */
     Set<DataSchemaNodeBuilder> getChildNodeBuilders();
 
+    /**
+     * Get child node by name.
+     *
+     * @param name
+     *            name of child to seek
+     * @return child node with given name if present, null otherwise
+     */
     DataSchemaNodeBuilder getDataChildByName(String name);
 
+    /**
+     * Add builder of child node to this node.
+     *
+     * @param childNode
+     */
     void addChildNode(DataSchemaNodeBuilder childNode);
 
+    /**
+     * Get already built groupings defined in this node.
+     *
+     * @return collection of GroupingDefinition objects
+     */
     Set<GroupingDefinition> getGroupings();
 
+    /**
+     * Get builders of groupings defined in this node.
+     *
+     * @return collection of grouping builders
+     */
     Set<GroupingBuilder> getGroupingBuilders();
 
+    /**
+     * Add builder of grouping statement to this node.
+     *
+     * @param groupingBuilder
+     */
     void addGrouping(GroupingBuilder groupingBuilder);
 
+    /**
+     * Add builder of uses statement to this node.
+     *
+     * @param usesBuilder
+     */
     void addUsesNode(UsesNodeBuilder usesBuilder);
 
+    /**
+     * Get builders of typedef statement defined in this node.
+     *
+     * @return
+     */
     Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
 
+    /**
+     * Add typedef builder to this node.
+     *
+     * @param typedefBuilder
+     */
     void addTypedef(TypeDefinitionBuilder typedefBuilder);
 
 }
index bf96a82..a217750 100644 (file)
@@ -16,12 +16,43 @@ import org.opendaylight.controller.yang.parser.builder.impl.ConstraintsBuilder;
  */
 public interface DataSchemaNodeBuilder extends SchemaNodeBuilder {
 
+    /**
+     * Build DataSchemaNode object from this builder.
+     */
     DataSchemaNode build();
 
+    /**
+     *
+     * @return true, if this node is added by augmentation, false otherwise
+     */
     boolean isAugmenting();
 
+    /**
+     * Set if this node is added by augmentation.
+     *
+     * @param augmenting
+     */
     void setAugmenting(boolean augmenting);
 
+    /**
+     * Get value of config statement.
+     *
+     * @return value of config statement
+     */
+    Boolean isConfiguration();
+
+    /**
+     * Set config statement.
+     *
+     * @param config
+     */
+    void setConfiguration(Boolean config);
+
+    /**
+     * Get constraints of this builder.
+     *
+     * @return constraints of this builder
+     */
     ConstraintsBuilder getConstraints();
 
 }
index 2806994..74ee330 100644 (file)
@@ -7,23 +7,25 @@
  */
 package org.opendaylight.controller.yang.parser.builder.api;
 
-import java.util.List;
 import java.util.Set;
 
 import org.opendaylight.controller.yang.model.api.GroupingDefinition;
-import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
 
 /**
  * Interface for builders of 'grouping' statement.
  */
 public interface GroupingBuilder extends DataNodeContainerBuilder, SchemaNodeBuilder, GroupingMember {
 
+    /**
+     * Build GroupingDefinition object from this builder.
+     */
     GroupingDefinition build();
 
-    DataSchemaNodeBuilder getChildNode(String name);
-
-    List<UnknownSchemaNodeBuilder> getUnknownNodes();
-
+    /**
+     * Get uses statement defined in this builder
+     *
+     * @return collection of builders of uses statements
+     */
     Set<UsesNodeBuilder> getUses();
 
 }
index bcdc077..c074f60 100644 (file)
@@ -13,8 +13,17 @@ package org.opendaylight.controller.yang.parser.builder.api;
  */
 public interface GroupingMember extends Builder {
 
+    /**
+     *
+     * @return true, if this node is added by uses statement, false otherwise
+     */
     boolean isAddedByUses();
 
+    /**
+     * Set if this node is added by uses.
+     *
+     * @param addedByUses
+     */
     void setAddedByUses(boolean addedByUses);
 
 }
index 6e872b3..13c96d3 100644 (file)
@@ -11,33 +11,78 @@ import org.opendaylight.controller.yang.common.QName;
 import org.opendaylight.controller.yang.model.api.SchemaNode;\r
 import org.opendaylight.controller.yang.model.api.SchemaPath;\r
 import org.opendaylight.controller.yang.model.api.Status;\r
-import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;\r
 \r
 /**\r
  * Interface for all builders of SchemaNode nodes.\r
  */\r
 public interface SchemaNodeBuilder extends Builder {\r
 \r
+    /**\r
+     * Get qname of this node.\r
+     *\r
+     * @return QName of this node\r
+     */\r
     QName getQName();\r
 \r
+    /**\r
+     * Get schema path of this node.\r
+     *\r
+     * @return SchemaPath of this node\r
+     */\r
     SchemaPath getPath();\r
 \r
+    /**\r
+     * Set schema path to this node.\r
+     *\r
+     * @param schemaPath\r
+     */\r
     void setPath(SchemaPath schemaPath);\r
 \r
+    /**\r
+     * Get description of this node.\r
+     *\r
+     * @return description statement\r
+     */\r
     String getDescription();\r
 \r
+    /**\r
+     * Set description to this node.\r
+     *\r
+     * @param description\r
+     */\r
     void setDescription(String description);\r
 \r
+    /**\r
+     * Get reference of this node.\r
+     *\r
+     * @return reference statement\r
+     */\r
     String getReference();\r
 \r
+    /**\r
+     * Set reference to this node.\r
+     *\r
+     * @param reference\r
+     */\r
     void setReference(String reference);\r
 \r
+    /**\r
+     * Get status of this node.\r
+     *\r
+     * @return status statement\r
+     */\r
     Status getStatus();\r
 \r
+    /**\r
+     * Set status to this node.\r
+     *\r
+     * @param status\r
+     */\r
     void setStatus(Status status);\r
 \r
-    void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode);\r
-\r
+    /**\r
+     * Build SchemaNode object from this builder.\r
+     */\r
     SchemaNode build();\r
 \r
 }\r
index ad92b22..8b2e669 100644 (file)
@@ -12,21 +12,54 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.TypeDefinition;
 
 /**
- * Builders of all nodes, which can have 'type' statement must implement this interface.
- * [typedef, type, leaf, leaf-list, deviate]
+ * Builders of all nodes, which can have 'type' statement must implement this
+ * interface. [typedef, type, leaf, leaf-list, deviate]
  */
 public interface TypeAwareBuilder extends Builder {
 
+    /**
+     * Get qname of this node.
+     *
+     * @return QName of this node
+     */
     QName getQName();
 
+    /**
+     * Get schema path of this node.
+     *
+     * @return SchemaPath of this node
+     */
     SchemaPath getPath();
 
+    /**
+     * Get resolved type of this node.
+     *
+     * @return type of this node if it is already resolved, null otherwise
+     */
     TypeDefinition<?> getType();
 
+    /**
+     * Get builder of type of this node.
+     *
+     * @return builder of type of this node or null of this builder has already
+     *         resolved type
+     */
     TypeDefinitionBuilder getTypedef();
 
+    /**
+     * Set resolved type to this node.
+     *
+     * @param type
+     *            type to set
+     */
     void setType(TypeDefinition<?> type);
 
+    /**
+     * Set builder of type to this node.
+     *
+     * @param typedef
+     *            builder of type to set
+     */
     void setTypedef(TypeDefinitionBuilder typedef);
 
 }
index 289dcfe..87c7b3c 100644 (file)
@@ -14,7 +14,6 @@ import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.model.api.type.LengthConstraint;\r
 import org.opendaylight.controller.yang.model.api.type.PatternConstraint;\r
 import org.opendaylight.controller.yang.model.api.type.RangeConstraint;\r
-import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;\r
 \r
 /**\r
  * Interface for builders of 'typedef' statement.\r
@@ -41,8 +40,6 @@ public interface TypeDefinitionBuilder extends TypeAwareBuilder, SchemaNodeBuild
 \r
     List<UnknownSchemaNode> getUnknownNodes();\r
 \r
-    List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders();\r
-\r
     Object getDefaultValue();\r
 \r
     void setDefaultValue(Object defaultValue);\r
index a2dacc2..42f714b 100644 (file)
@@ -18,13 +18,11 @@ import org.opendaylight.controller.yang.model.api.SchemaPath;
 import org.opendaylight.controller.yang.model.api.Status;
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.parser.builder.api.AbstractSchemaNodeBuilder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
 import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingMember;
 import org.opendaylight.controller.yang.parser.util.Comparators;
 
-public final class AnyXmlBuilder extends AbstractSchemaNodeBuilder implements DataSchemaNodeBuilder, GroupingMember,
-        ConfigNode {
+public final class AnyXmlBuilder extends AbstractSchemaNodeBuilder implements DataSchemaNodeBuilder, GroupingMember {
     private boolean built;
     private final AnyXmlSchemaNodeImpl instance;
     private final ConstraintsBuilder constraints;
index 7fcee2e..6d8b789 100644 (file)
@@ -52,7 +52,6 @@ public final class AugmentationSchemaBuilderImpl extends AbstractDataNodeContain
     private SchemaPath finalAugmentTarget;
 
     private final Set<UsesNodeBuilder> usesNodes = new HashSet<UsesNodeBuilder>();
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     private boolean resolved;
 
     AugmentationSchemaBuilderImpl(final int line, final String augmentTargetStr) {
@@ -194,15 +193,6 @@ public final class AugmentationSchemaBuilderImpl extends AbstractDataNodeContain
         return augmentTargetStr;
     }
 
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return addedUnknownNodes;
-    }
-
-    @Override
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
     @Override
     public int hashCode() {
         final int prime = 17;
index 7ed47bf..0fcfd33 100644 (file)
@@ -25,14 +25,13 @@ import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.parser.builder.api.AbstractSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.AugmentationSchemaBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
 import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingMember;
 import org.opendaylight.controller.yang.parser.util.Comparators;
 import org.opendaylight.controller.yang.parser.util.ParserUtils;
 
 public final class ChoiceBuilder extends AbstractSchemaNodeBuilder implements DataSchemaNodeBuilder,
-        AugmentationTargetBuilder, GroupingMember, ConfigNode {
+        AugmentationTargetBuilder, GroupingMember {
     private boolean isBuilt;
     private final ChoiceNodeImpl instance;
     // DataSchemaNode args
@@ -130,7 +129,7 @@ public final class ChoiceBuilder extends AbstractSchemaNodeBuilder implements Da
     public void addChildNode(DataSchemaNodeBuilder childNode) {
         if (!(childNode instanceof ChoiceCaseBuilder)) {
             ChoiceCaseBuilder caseBuilder = new ChoiceCaseBuilder(childNode.getLine(), childNode.getQName());
-            if(childNode.isAugmenting()) {
+            if (childNode.isAugmenting()) {
                 caseBuilder.setAugmenting(true);
                 childNode.setAugmenting(false);
             }
index e6c81ab..46821b2 100644 (file)
@@ -37,7 +37,6 @@ public final class ChoiceCaseBuilder extends AbstractDataNodeContainerBuilder im
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     // DataSchemaNode args
     private boolean augmenting;
     private final ConstraintsBuilder constraints;
@@ -150,15 +149,6 @@ public final class ChoiceCaseBuilder extends AbstractDataNodeContainerBuilder im
         this.augmenting = augmenting;
     }
 
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return addedUnknownNodes;
-    }
-
-    @Override
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
     public Set<UsesNodeBuilder> getUsesNodes() {
         return addedUsesNodes;
     }
@@ -178,6 +168,16 @@ public final class ChoiceCaseBuilder extends AbstractDataNodeContainerBuilder im
         throw new YangParseException(line, "Can not add type definition to choice case.");
     }
 
+    @Override
+    public Boolean isConfiguration() {
+        return false;
+    }
+
+    @Override
+    public void setConfiguration(final Boolean configuration) {
+        throw new YangParseException(line, "Can not add config statement to choice case.");
+    }
+
     @Override
     public ConstraintsBuilder getConstraints() {
         return constraints;
index 1351f56..5ec825b 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.controller.yang.parser.builder.impl;
 
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import org.opendaylight.controller.yang.model.api.ConstraintDefinition;
@@ -66,10 +67,15 @@ public final class ConstraintsBuilder implements Builder {
     }
 
     @Override
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {
+    public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {
         throw new YangParseException(line, "Can not add unknown node to constraints.");
     }
 
+    @Override
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
+        return Collections.emptyList();
+    }
+
     public Integer getMinElements() {
         return min;
     }
index 545abea..c85c12f 100644 (file)
@@ -30,7 +30,6 @@ import org.opendaylight.controller.yang.model.api.UsesNode;
 import org.opendaylight.controller.yang.parser.builder.api.AbstractDataNodeContainerBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.AugmentationSchemaBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
 import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingMember;
@@ -39,7 +38,7 @@ import org.opendaylight.controller.yang.parser.builder.api.UsesNodeBuilder;
 import org.opendaylight.controller.yang.parser.util.Comparators;
 
 public final class ContainerSchemaNodeBuilder extends AbstractDataNodeContainerBuilder implements
-        AugmentationTargetBuilder, DataSchemaNodeBuilder, GroupingMember, ConfigNode {
+        AugmentationTargetBuilder, DataSchemaNodeBuilder, GroupingMember {
     private boolean isBuilt;
     private final ContainerSchemaNodeImpl instance;
 
@@ -48,8 +47,6 @@ public final class ContainerSchemaNodeBuilder extends AbstractDataNodeContainerB
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
-    private List<UnknownSchemaNode> unknownNodes;
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     // DataSchemaNode args
     private boolean augmenting;
     private boolean addedByUses;
@@ -96,7 +93,7 @@ public final class ContainerSchemaNodeBuilder extends AbstractDataNodeContainerB
         augmentations = b.augmentations;
         addedAugmentations.addAll(b.getAugmentations());
         unknownNodes = b.unknownNodes;
-        addedUnknownNodes.addAll(b.getUnknownNodes());
+        addedUnknownNodes.addAll(b.getUnknownNodeBuilders());
     }
 
     @Override
@@ -314,19 +311,6 @@ public final class ContainerSchemaNodeBuilder extends AbstractDataNodeContainerB
         this.presence = presence;
     }
 
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return addedUnknownNodes;
-    }
-
-    @Override
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
-    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
-        this.unknownNodes = unknownNodes;
-    }
-
     @Override
     public int hashCode() {
         final int prime = 31;
index afc0e3b..42347cb 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.controller.yang.parser.util.YangParseException;
 
 public final class DeviationBuilder implements Builder {
     private final int line;
+    private final String targetPathStr;
     private Builder parent;
     private boolean isBuilt;
     private final DeviationImpl instance;
@@ -35,6 +36,7 @@ public final class DeviationBuilder implements Builder {
             throw new YangParseException(line, "Deviation argument string must be an absolute schema node identifier.");
         }
         this.line = line;
+        this.targetPathStr = targetPathStr;
         this.targetPath = ParserListenerUtils.parseAugmentPath(targetPathStr);
         instance = new DeviationImpl();
     }
@@ -79,7 +81,12 @@ public final class DeviationBuilder implements Builder {
     }
 
     @Override
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
+        return addedUnknownNodes;
+    }
+
+    @Override
+    public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {
         addedUnknownNodes.add(unknownNode);
     }
 
@@ -110,6 +117,11 @@ public final class DeviationBuilder implements Builder {
         this.reference = reference;
     }
 
+    @Override
+    public String toString() {
+        return "deviation " + targetPathStr;
+    }
+
     private final class DeviationImpl implements Deviation {
         private SchemaPath targetPath;
         private Deviate deviate;
index 764d2bf..fbd55ab 100644 (file)
@@ -60,6 +60,11 @@ public final class ExtensionBuilder extends AbstractSchemaNodeBuilder {
         instance.setArgument(argument);
     }
 
+    @Override
+    public String toString() {
+        return "extension " + qname.getLocalName();
+    }
+
     private final class ExtensionDefinitionImpl implements ExtensionDefinition {
         private final QName qname;
         private String argument;
index 4d5ce97..53129f1 100644 (file)
@@ -51,6 +51,11 @@ public final class FeatureBuilder extends AbstractSchemaNodeBuilder {
         return instance;
     }
 
+    @Override
+    public String toString() {
+        return "feature " + qname.getLocalName();
+    }
+
     private final class FeatureDefinitionImpl implements FeatureDefinition {
         private final QName qname;
         private SchemaPath path;
index 0099b4f..2050348 100644 (file)
@@ -79,7 +79,7 @@ public final class GroupingBuilderImpl implements GroupingBuilder {
         groupings = builder.getGroupings();
         addedGroupings.addAll(builder.getGroupingBuilders());
         addedUsesNodes.addAll(builder.getUses());
-        addedUnknownNodes.addAll(builder.getUnknownNodes());
+        addedUnknownNodes.addAll(builder.getUnknownNodeBuilders());
     }
 
     @Override
@@ -231,18 +231,6 @@ public final class GroupingBuilderImpl implements GroupingBuilder {
         this.addedByUses = addedByUses;
     }
 
-    @Override
-    public DataSchemaNodeBuilder getChildNode(String name) {
-        DataSchemaNodeBuilder result = null;
-        for (DataSchemaNodeBuilder node : addedChildNodes) {
-            if (node.getQName().getLocalName().equals(name)) {
-                result = node;
-                break;
-            }
-        }
-        return result;
-    }
-
     @Override
     public Set<DataSchemaNode> getChildNodes() {
         return childNodes;
@@ -306,12 +294,12 @@ public final class GroupingBuilderImpl implements GroupingBuilder {
     }
 
     @Override
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
         return addedUnknownNodes;
     }
 
     @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder unknownNode) {
+    public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
         addedUnknownNodes.add(unknownNode);
     }
 
@@ -319,6 +307,11 @@ public final class GroupingBuilderImpl implements GroupingBuilder {
         this.unknownNodes = unknownNodes;
     }
 
+    @Override
+    public String toString() {
+        return "grouping " + qname.getLocalName();
+    }
+
     private final class GroupingDefinitionImpl implements GroupingDefinition {
         private final QName qname;
         private SchemaPath path;
index 96b4bd4..61ad3a7 100644 (file)
@@ -79,6 +79,11 @@ public final class IdentitySchemaNodeBuilder extends AbstractSchemaNodeBuilder {
         this.baseIdentity = baseType;
     }
 
+    @Override
+    public String toString() {
+        return "identity " + qname.getLocalName();
+    }
+
     private final class IdentitySchemaNodeImpl implements IdentitySchemaNode {
         private final QName qname;
         private IdentitySchemaNode baseIdentity;
index 3b50596..43922fa 100644 (file)
@@ -111,7 +111,7 @@ public final class IdentityrefTypeBuilder extends AbstractTypeAwareBuilder imple
     }
 
     @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder unknownNode) {
+    public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder unknownNode) {
         throw new YangParseException(line, "Can not add unknown node to " + NAME);
     }
 
index 555a326..dcbe1dd 100644 (file)
@@ -19,13 +19,12 @@ import org.opendaylight.controller.yang.model.api.Status;
 import org.opendaylight.controller.yang.model.api.TypeDefinition;
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.parser.builder.api.AbstractTypeAwareBuilder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
 import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingMember;
 import org.opendaylight.controller.yang.parser.util.Comparators;
 
 public final class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder implements DataSchemaNodeBuilder,
-        GroupingMember, ConfigNode {
+        GroupingMember {
     private boolean isBuilt;
     private final LeafListSchemaNodeImpl instance;
     // SchemaNode args
@@ -33,8 +32,6 @@ public final class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder im
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
-    private List<UnknownSchemaNode> unknownNodes;
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     // DataSchemaNode args
     private boolean augmenting;
     private boolean addedByUses;
@@ -67,7 +64,7 @@ public final class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder im
         configuration = b.isConfiguration();
         userOrdered = b.isUserOrdered();
         unknownNodes = b.unknownNodes;
-        addedUnknownNodes.addAll(b.getUnknownNodes());
+        addedUnknownNodes.addAll(b.getUnknownNodeBuilders());
     }
 
     @Override
@@ -183,19 +180,6 @@ public final class LeafListSchemaNodeBuilder extends AbstractTypeAwareBuilder im
         this.userOrdered = userOrdered;
     }
 
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return addedUnknownNodes;
-    }
-
-    @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
-    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
-        this.unknownNodes = unknownNodes;
-    }
-
     @Override
     public int hashCode() {
         final int prime = 31;
index 071447b..2ab6407 100644 (file)
@@ -19,13 +19,12 @@ import org.opendaylight.controller.yang.model.api.Status;
 import org.opendaylight.controller.yang.model.api.TypeDefinition;
 import org.opendaylight.controller.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.controller.yang.parser.builder.api.AbstractTypeAwareBuilder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
 import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingMember;
 import org.opendaylight.controller.yang.parser.util.Comparators;
 
 public final class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implements DataSchemaNodeBuilder,
-        GroupingMember, ConfigNode {
+        GroupingMember {
     private boolean isBuilt;
     private final LeafSchemaNodeImpl instance;
     // SchemaNode args
@@ -33,8 +32,6 @@ public final class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implem
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
-    private List<UnknownSchemaNode> unknownNodes;
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     // DataSchemaNode args
     private boolean augmenting;
     private boolean addedByUses;
@@ -67,7 +64,7 @@ public final class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implem
         addedByUses = b.isAddedByUses();
         configuration = b.isConfiguration();
         unknownNodes = b.unknownNodes;
-        addedUnknownNodes.addAll(b.getUnknownNodes());
+        addedUnknownNodes.addAll(b.getUnknownNodeBuilders());
 
         defaultStr = b.getDefaultStr();
         unitsStr = b.getUnits();
@@ -123,19 +120,6 @@ public final class LeafSchemaNodeBuilder extends AbstractTypeAwareBuilder implem
         return constraints;
     }
 
-    @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return addedUnknownNodes;
-    }
-
-    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
-        this.unknownNodes = unknownNodes;
-    }
-
     public String getDescription() {
         return description;
     }
index a99e6a7..9fc297e 100644 (file)
@@ -30,7 +30,6 @@ import org.opendaylight.controller.yang.model.api.UsesNode;
 import org.opendaylight.controller.yang.parser.builder.api.AbstractDataNodeContainerBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.AugmentationSchemaBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.AugmentationTargetBuilder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
 import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.GroupingMember;
@@ -39,7 +38,7 @@ import org.opendaylight.controller.yang.parser.builder.api.UsesNodeBuilder;
 import org.opendaylight.controller.yang.parser.util.Comparators;
 
 public final class ListSchemaNodeBuilder extends AbstractDataNodeContainerBuilder implements DataSchemaNodeBuilder,
-        AugmentationTargetBuilder, GroupingMember, ConfigNode {
+        AugmentationTargetBuilder, GroupingMember {
     private boolean isBuilt;
     private final ListSchemaNodeImpl instance;
     // SchemaNode args
@@ -47,8 +46,6 @@ public final class ListSchemaNodeBuilder extends AbstractDataNodeContainerBuilde
     private String description;
     private String reference;
     private Status status = Status.CURRENT;
-    private List<UnknownSchemaNode> unknownNodes;
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     // DataSchemaNode args
     private boolean augmenting;
     private boolean addedByUses;
@@ -97,7 +94,7 @@ public final class ListSchemaNodeBuilder extends AbstractDataNodeContainerBuilde
         augmentations = b.augmentations;
         addedAugmentations.addAll(b.getAugmentations());
         unknownNodes = b.unknownNodes;
-        addedUnknownNodes.addAll(b.getUnknownNodes());
+        addedUnknownNodes.addAll(b.getUnknownNodeBuilders());
     }
 
     @Override
@@ -315,19 +312,6 @@ public final class ListSchemaNodeBuilder extends AbstractDataNodeContainerBuilde
         this.userOrdered = userOrdered;
     }
 
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
-        return addedUnknownNodes;
-    }
-
-    @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
-    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
-        this.unknownNodes = unknownNodes;
-    }
-
     @Override
     public int hashCode() {
         final int prime = 31;
index 47f1fbc..a3409c5 100644 (file)
@@ -79,7 +79,6 @@ public class ModuleBuilder extends AbstractDataNodeContainerBuilder {
     private final Set<DeviationBuilder> addedDeviations = new HashSet<DeviationBuilder>();
     private final Set<TypeDefinitionBuilder> addedTypedefs = new HashSet<TypeDefinitionBuilder>();
     private final List<ExtensionBuilder> addedExtensions = new ArrayList<ExtensionBuilder>();
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     private final List<UnknownSchemaNodeBuilder> allUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     public ModuleBuilder(final String name) {
@@ -709,7 +708,7 @@ public class ModuleBuilder extends AbstractDataNodeContainerBuilder {
     }
 
     @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder builder) {
+    public void addUnknownNodeBuilder(final UnknownSchemaNodeBuilder builder) {
         addedUnknownNodes.add(builder);
         allUnknownNodes.add(builder);
     }
@@ -724,11 +723,11 @@ public class ModuleBuilder extends AbstractDataNodeContainerBuilder {
             addedUnknownNodes.add(builder);
         } else {
             if (parent instanceof SchemaNodeBuilder) {
-                ((SchemaNodeBuilder) parent).addUnknownSchemaNode(builder);
+                ((SchemaNodeBuilder) parent).addUnknownNodeBuilder(builder);
             } else if (parent instanceof DataNodeContainerBuilder) {
-                ((DataNodeContainerBuilder) parent).addUnknownSchemaNode(builder);
+                ((DataNodeContainerBuilder) parent).addUnknownNodeBuilder(builder);
             } else if (parent instanceof RefineHolder) {
-                ((RefineHolder) parent).addUnknownSchemaNode(builder);
+                ((RefineHolder) parent).addUnknownNodeBuilder(builder);
             } else {
                 throw new YangParseException(name, line, "Unresolved parent of unknown node '" + qname.getLocalName()
                         + "'");
index 1c49628..14b701f 100644 (file)
@@ -48,7 +48,6 @@ public final class NotificationBuilder extends AbstractDataNodeContainerBuilder
     private final Set<UsesNodeBuilder> addedUsesNodes = new HashSet<UsesNodeBuilder>();
     private Set<AugmentationSchema> augmentations;
     private final Set<AugmentationSchemaBuilder> addedAugmentations = new HashSet<AugmentationSchemaBuilder>();
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
 
     NotificationBuilder(final int line, final QName qname) {
         super(line, qname);
@@ -190,11 +189,6 @@ public final class NotificationBuilder extends AbstractDataNodeContainerBuilder
         this.augmentations = augmentations;
     }
 
-    @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
     @Override
     public String toString() {
         return "notification " + getQName().getLocalName();
index 1d1d24b..7ff7847 100644 (file)
@@ -28,8 +28,6 @@ import org.opendaylight.controller.yang.parser.util.YangParseException;
 
 public final class TypeDefinitionBuilderImpl extends AbstractTypeAwareBuilder implements TypeDefinitionBuilder {
     private SchemaPath schemaPath;
-    private List<UnknownSchemaNode> unknownNodes;
-    private final List<UnknownSchemaNodeBuilder> addedUnknownNodes = new ArrayList<UnknownSchemaNodeBuilder>();
     private List<RangeConstraint> ranges = Collections.emptyList();
     private List<LengthConstraint> lengths = Collections.emptyList();
     private List<PatternConstraint> patterns = Collections.emptyList();
@@ -183,20 +181,6 @@ public final class TypeDefinitionBuilderImpl extends AbstractTypeAwareBuilder im
         return Collections.emptyList();
     }
 
-    @Override
-    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
-        return addedUnknownNodes;
-    }
-
-    @Override
-    public void addUnknownSchemaNode(final UnknownSchemaNodeBuilder unknownNode) {
-        addedUnknownNodes.add(unknownNode);
-    }
-
-    public void setUnknownNodes(List<UnknownSchemaNode> unknownNodes) {
-        this.unknownNodes = unknownNodes;
-    }
-
     @Override
     public List<RangeConstraint> getRanges() {
         return ranges;
index ecbc1c5..3b1eb33 100644 (file)
@@ -176,12 +176,13 @@ public final class UsesNodeBuilderImpl implements UsesNodeBuilder {
         refines.add(refine);\r
     }\r
 \r
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {\r
+    @Override\r
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {\r
         return addedUnknownNodes;\r
     }\r
 \r
     @Override\r
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {\r
+    public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {\r
         addedUnknownNodes.add(unknownNode);\r
     }\r
 \r
index 5850abe..7d64b94 100644 (file)
@@ -98,7 +98,7 @@ import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
 public final class YangParserImpl implements YangModelParser {
-    private static final Logger logger = LoggerFactory.getLogger(YangParserImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(YangParserImpl.class);
 
     @Override
     public Set<Module> parseYangModels(final List<File> yangFiles) {
@@ -114,7 +114,7 @@ public final class YangParserImpl implements YangModelParser {
                 try {
                     inputStreams.put(new FileInputStream(yangFile), yangFile);
                 } catch (FileNotFoundException e) {
-                    logger.warn("Exception while reading yang file: " + yangFile.getName(), e);
+                    LOG.warn("Exception while reading yang file: " + yangFile.getName(), e);
                 }
             }
 
@@ -127,7 +127,7 @@ public final class YangParserImpl implements YangModelParser {
                 try {
                     is.close();
                 } catch (IOException e) {
-                    logger.debug("Failed to close stream.");
+                    LOG.debug("Failed to close stream.");
                 }
             }
 
@@ -161,7 +161,7 @@ public final class YangParserImpl implements YangModelParser {
                 try {
                     inputStreams.put(new FileInputStream(yangFile), yangFile);
                 } catch (FileNotFoundException e) {
-                    logger.warn("Exception while reading yang file: " + yangFile.getName(), e);
+                    LOG.warn("Exception while reading yang file: " + yangFile.getName(), e);
                 }
             }
 
@@ -173,7 +173,7 @@ public final class YangParserImpl implements YangModelParser {
                 try {
                     is.close();
                 } catch (IOException e) {
-                    logger.debug("Failed to close stream.");
+                    LOG.debug("Failed to close stream.");
                 }
             }
 
@@ -294,7 +294,7 @@ public final class YangParserImpl implements YangModelParser {
 
             result = parser.yang();
         } catch (IOException e) {
-            logger.warn("Exception while reading yang file: " + yangStream, e);
+            LOG.warn("Exception while reading yang file: " + yangStream, e);
         }
         return result;
     }
@@ -1118,11 +1118,11 @@ public final class YangParserImpl implements YangModelParser {
             // uses has not path
             parent.addUsesNode(newUses);
         }
-        for (UnknownSchemaNodeBuilder un : targetGrouping.getUnknownNodes()) {
+        for (UnknownSchemaNodeBuilder un : targetGrouping.getUnknownNodeBuilders()) {
             UnknownSchemaNodeBuilder newUn = new UnknownSchemaNodeBuilder(un);
             newUn.setAddedByUses(true);
             newUn.setPath(createSchemaPath(parentPath, un.getQName().getLocalName()));
-            parent.addUnknownSchemaNode(newUn);
+            parent.addUnknownNodeBuilder(newUn);
         }
     }
 
@@ -1192,7 +1192,7 @@ public final class YangParserImpl implements YangModelParser {
             UnknownSchemaNodeBuilder newNode = createUnknownSchemaNode(un, line);
             newNode.setAddedByUses(true);
             newNode.setPath(createSchemaPath(parentPath, un.getQName().getLocalName()));
-            parent.addUnknownSchemaNode(newNode);
+            parent.addUnknownNodeBuilder(newNode);
         }
     }
 
@@ -1227,7 +1227,7 @@ public final class YangParserImpl implements YangModelParser {
                             nodeType.getPrefix(), nodeType.getLocalName());
                     usnb.setNodeType(newNodeType);
                 } catch (YangParseException e) {
-                    logger.debug(module.getName(), usnb.getLine(), "Failed to find unknown node type: " + nodeType);
+                    LOG.debug(module.getName(), usnb.getLine(), "Failed to find unknown node type: " + nodeType);
                 }
             }
         }
@@ -1255,7 +1255,7 @@ public final class YangParserImpl implements YangModelParser {
 
                     unknownNodeBuilder.setNodeType(newNodeType);
                 } catch (YangParseException e) {
-                    logger.debug(module.getName(), unknownNodeBuilder.getLine(), "Failed to find unknown node type: "
+                    LOG.debug(module.getName(), unknownNodeBuilder.getLine(), "Failed to find unknown node type: "
                             + nodeType);
                 }
             }
index eb0fc21..155dece 100644 (file)
@@ -379,7 +379,7 @@ public final class YangParserListenerImpl extends YangParserBaseListener {
                 }
             }
         } else {
-            type = parseUnknownTypeWithBody(typeQName, typeBody, actualPath, namespace, revision, yangModelPrefix,
+            type = parseUnknownTypeWithBody(moduleName, typeQName, typeBody, actualPath, namespace, revision, yangModelPrefix,
                     moduleBuilder.getActualNode());
             // add parent node of this type statement to dirty nodes
             moduleBuilder.markActualNodeDirty();
index f139af8..5f291d7 100644 (file)
@@ -31,6 +31,7 @@ import org.opendaylight.controller.antlrv4.code.gen.YangParser.Error_app_tag_stm
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Error_message_stmtContext;
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Fraction_digits_stmtContext;
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Identityref_specificationContext;
+import org.opendaylight.controller.antlrv4.code.gen.YangParser.Instance_identifier_specificationContext;
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Leafref_specificationContext;
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Length_stmtContext;
 import org.opendaylight.controller.antlrv4.code.gen.YangParser.Mandatory_argContext;
@@ -108,7 +109,7 @@ import org.opendaylight.controller.yang.model.util.Uint64;
 import org.opendaylight.controller.yang.model.util.Uint8;
 import org.opendaylight.controller.yang.model.util.UnknownType;
 import org.opendaylight.controller.yang.parser.builder.api.Builder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
+import org.opendaylight.controller.yang.parser.builder.api.DataSchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.SchemaNodeBuilder;
 import org.opendaylight.controller.yang.parser.builder.api.TypeDefinitionBuilder;
 import org.opendaylight.controller.yang.parser.builder.impl.ChoiceBuilder;
@@ -119,7 +120,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public final class ParserListenerUtils {
-    private static final Logger logger = LoggerFactory.getLogger(ParserListenerUtils.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ParserListenerUtils.class);
 
     private ParserListenerUtils() {
     }
@@ -189,7 +190,7 @@ public final class ParserListenerUtils {
                 } else if ("obsolete".equals(statusArgStr)) {
                     result = Status.OBSOLETE;
                 } else {
-                    logger.warn("Invalid 'status' statement: " + statusArgStr);
+                    LOG.warn("Invalid 'status' statement: " + statusArgStr);
                 }
             }
         }
@@ -334,12 +335,12 @@ public final class ParserListenerUtils {
             final List<String> path, final URI namespace, final Date revision, final String prefix) {
         List<EnumTypeDefinition.EnumPair> enumConstants = new ArrayList<EnumTypeDefinition.EnumPair>();
 
-        for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree enumSpecChild = ctx.getChild(j);
+        for (int i = 0; i < ctx.getChildCount(); i++) {
+            ParseTree enumSpecChild = ctx.getChild(i);
             if (enumSpecChild instanceof Enum_specificationContext) {
                 int highestValue = -1;
-                for (int k = 0; k < enumSpecChild.getChildCount(); k++) {
-                    ParseTree enumChild = enumSpecChild.getChild(k);
+                for (int j = 0; j < enumSpecChild.getChildCount(); j++) {
+                    ParseTree enumChild = enumSpecChild.getChild(j);
                     if (enumChild instanceof Enum_stmtContext) {
                         EnumPair enumPair = createEnumPair((Enum_stmtContext) enumChild, highestValue, path, namespace,
                                 revision, prefix);
@@ -423,7 +424,7 @@ public final class ParserListenerUtils {
         private String description;
         private String reference;
         private Status status;
-        private List<UnknownSchemaNode> extensionSchemaNodes = Collections.emptyList();
+        private List<UnknownSchemaNode> unknownNodes = Collections.emptyList();
         private String name;
         private Integer value;
 
@@ -454,7 +455,7 @@ public final class ParserListenerUtils {
 
         @Override
         public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-            return extensionSchemaNodes;
+            return unknownNodes;
         }
 
         @Override
@@ -473,7 +474,7 @@ public final class ParserListenerUtils {
             int result = 1;
             result = prime * result + ((qname == null) ? 0 : qname.hashCode());
             result = prime * result + ((path == null) ? 0 : path.hashCode());
-            result = prime * result + ((extensionSchemaNodes == null) ? 0 : extensionSchemaNodes.hashCode());
+            result = prime * result + ((unknownNodes == null) ? 0 : unknownNodes.hashCode());
             result = prime * result + ((name == null) ? 0 : name.hashCode());
             result = prime * result + ((value == null) ? 0 : value.hashCode());
             return result;
@@ -505,11 +506,11 @@ public final class ParserListenerUtils {
             } else if (!path.equals(other.path)) {
                 return false;
             }
-            if (extensionSchemaNodes == null) {
-                if (other.extensionSchemaNodes != null) {
+            if (unknownNodes == null) {
+                if (other.unknownNodes != null) {
                     return false;
                 }
-            } else if (!extensionSchemaNodes.equals(other.extensionSchemaNodes)) {
+            } else if (!unknownNodes.equals(other.unknownNodes)) {
                 return false;
             }
             if (name == null) {
@@ -544,11 +545,11 @@ public final class ParserListenerUtils {
      */
     private static List<RangeConstraint> getRangeConstraints(final Type_body_stmtsContext ctx) {
         List<RangeConstraint> rangeConstraints = Collections.emptyList();
-        outer: for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree numRestrChild = ctx.getChild(j);
+        outer: for (int i = 0; i < ctx.getChildCount(); i++) {
+            ParseTree numRestrChild = ctx.getChild(i);
             if (numRestrChild instanceof Numerical_restrictionsContext) {
-                for (int k = 0; k < numRestrChild.getChildCount(); k++) {
-                    ParseTree rangeChild = numRestrChild.getChild(k);
+                for (int j = 0; j < numRestrChild.getChildCount(); j++) {
+                    ParseTree rangeChild = numRestrChild.getChild(j);
                     if (rangeChild instanceof Range_stmtContext) {
                         rangeConstraints = parseRangeConstraints((Range_stmtContext) rangeChild);
                         break outer;
@@ -610,11 +611,11 @@ public final class ParserListenerUtils {
      */
     private static List<LengthConstraint> getLengthConstraints(final Type_body_stmtsContext ctx) {
         List<LengthConstraint> lengthConstraints = Collections.emptyList();
-        outer: for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree stringRestrChild = ctx.getChild(j);
+        outer: for (int i = 0; i < ctx.getChildCount(); i++) {
+            ParseTree stringRestrChild = ctx.getChild(i);
             if (stringRestrChild instanceof String_restrictionsContext) {
-                for (int k = 0; k < stringRestrChild.getChildCount(); k++) {
-                    ParseTree lengthChild = stringRestrChild.getChild(k);
+                for (int j = 0; j < stringRestrChild.getChildCount(); j++) {
+                    ParseTree lengthChild = stringRestrChild.getChild(j);
                     if (lengthChild instanceof Length_stmtContext) {
                         lengthConstraints = parseLengthConstraints((Length_stmtContext) lengthChild);
                         break outer;
@@ -697,11 +698,11 @@ public final class ParserListenerUtils {
     private static List<PatternConstraint> getPatternConstraint(final Type_body_stmtsContext ctx) {
         List<PatternConstraint> patterns = new ArrayList<PatternConstraint>();
 
-        for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree stringRestrChild = ctx.getChild(j);
+        for (int i = 0; i < ctx.getChildCount(); i++) {
+            ParseTree stringRestrChild = ctx.getChild(i);
             if (stringRestrChild instanceof String_restrictionsContext) {
-                for (int k = 0; k < stringRestrChild.getChildCount(); k++) {
-                    ParseTree lengthChild = stringRestrChild.getChild(k);
+                for (int j = 0; j < stringRestrChild.getChildCount(); j++) {
+                    ParseTree lengthChild = stringRestrChild.getChild(j);
                     if (lengthChild instanceof Pattern_stmtContext) {
                         patterns.add(parsePatternConstraint((Pattern_stmtContext) lengthChild));
                     }
@@ -761,15 +762,17 @@ public final class ParserListenerUtils {
      *
      * @param ctx
      *            type body context to parse
+     * @param moduleName
+     *            name of current module
      * @return 'fraction-digits' value if present in given context, null
      *         otherwise
      */
-    private static Integer getFractionDigits(Type_body_stmtsContext ctx) {
+    private static Integer getFractionDigits(Type_body_stmtsContext ctx, String moduleName) {
         Integer result = null;
-        for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree dec64specChild = ctx.getChild(j);
+        for (int i = 0; i < ctx.getChildCount(); i++) {
+            ParseTree dec64specChild = ctx.getChild(i);
             if (dec64specChild instanceof Decimal64_specificationContext) {
-                result = parseFractionDigits((Decimal64_specificationContext) dec64specChild);
+                result = parseFractionDigits((Decimal64_specificationContext) dec64specChild, moduleName);
             }
         }
         return result;
@@ -780,19 +783,21 @@ public final class ParserListenerUtils {
      *
      * @param ctx
      *            decimal64 context
+     * @param moduleName
+     *            name of current module
      * @return fraction-digits value as Integer
      */
-    private static Integer parseFractionDigits(Decimal64_specificationContext ctx) {
+    private static Integer parseFractionDigits(Decimal64_specificationContext ctx, String moduleName) {
         Integer result = null;
-        for (int k = 0; k < ctx.getChildCount(); k++) {
-            ParseTree fdChild = ctx.getChild(k);
+        for (int i = 0; i < ctx.getChildCount(); i++) {
+            ParseTree fdChild = ctx.getChild(i);
             if (fdChild instanceof Fraction_digits_stmtContext) {
                 String value = stringFromNode(fdChild);
                 try {
                     result = Integer.valueOf(value);
                 } catch (NumberFormatException e) {
-                    throw new YangParseException(ctx.getStart().getLine(), "Unable to parse fraction digits value '"
-                            + value + "'.", e);
+                    throw new YangParseException(moduleName, ctx.getStart().getLine(),
+                            "Unable to parse fraction digits value '" + value + "'.", e);
                 }
             }
         }
@@ -898,14 +903,14 @@ public final class ParserListenerUtils {
      * list are determined by the user or the system. The argument is one of the
      * strings "system" or "user". If not present, order defaults to "system".
      *
-     * @param childNode
+     * @param ctx
      *            Ordered_by_stmtContext
      * @return true, if ordered-by contains value 'user', false otherwise
      */
-    public static boolean parseUserOrdered(Ordered_by_stmtContext childNode) {
+    public static boolean parseUserOrdered(Ordered_by_stmtContext ctx) {
         boolean result = false;
-        for (int j = 0; j < childNode.getChildCount(); j++) {
-            ParseTree orderArg = childNode.getChild(j);
+        for (int j = 0; j < ctx.getChildCount(); j++) {
+            ParseTree orderArg = ctx.getChild(j);
             if (orderArg instanceof Ordered_by_argContext) {
                 String orderStr = stringFromNode(orderArg);
                 if ("system".equals(orderStr)) {
@@ -913,30 +918,44 @@ public final class ParserListenerUtils {
                 } else if ("user".equals(orderStr)) {
                     result = true;
                 } else {
-                    logger.warn("Invalid 'orderedby' statement.");
+                    LOG.warn("Invalid 'ordered-by' statement.");
                 }
             }
         }
         return result;
     }
 
+    /**
+     * Get config statement from given context. If there is no config statement,
+     * return config value of parent
+     *
+     * @param ctx
+     *            context to parse
+     * @param parent
+     *            parent node
+     * @param moduleName
+     *            name of current module
+     * @param line
+     *            line in current module
+     * @return config statement parsed from given context
+     */
     public static Boolean getConfig(final ParseTree ctx, final Builder parent, final String moduleName, final int line) {
         Boolean result = null;
         // parse configuration statement
-        Boolean configuration = null;
+        Boolean config = null;
         for (int i = 0; i < ctx.getChildCount(); i++) {
             ParseTree child = ctx.getChild(i);
             if (child instanceof Config_stmtContext) {
-                configuration = parseConfig((Config_stmtContext) child);
+                config = parseConfig((Config_stmtContext) child);
                 break;
             }
         }
 
         // If 'config' is not specified, the default is the same as the parent
         // schema node's 'config' value
-        if (configuration == null) {
-            if (parent instanceof ConfigNode) {
-                Boolean parentConfig = ((ConfigNode) parent).isConfiguration();
+        if (config == null) {
+            if (parent instanceof DataSchemaNodeBuilder) {
+                Boolean parentConfig = ((DataSchemaNodeBuilder) parent).isConfiguration();
                 // If the parent node is a rpc input or output, it can has
                 // config set to null
                 result = parentConfig == null ? true : parentConfig;
@@ -958,14 +977,14 @@ public final class ParserListenerUtils {
         } else {
             // Check first: if a node has 'config' set to 'false', no node
             // underneath it can have 'config' set to 'true'
-            if (parent instanceof ConfigNode) {
-                Boolean parentConfig = ((ConfigNode) parent).isConfiguration();
-                if (parentConfig == false && configuration == true) {
+            if (parent instanceof DataSchemaNodeBuilder && !(parent instanceof ChoiceCaseBuilder)) {
+                Boolean parentConfig = ((DataSchemaNodeBuilder) parent).isConfiguration();
+                if (!parentConfig && config) {
                     throw new YangParseException(moduleName, line,
                             "Can not set 'config' to 'true' if parent node has 'config' set to 'false'");
                 }
             }
-            result = configuration;
+            result = config;
         }
 
         return result;
@@ -1004,6 +1023,8 @@ public final class ParserListenerUtils {
     /**
      * Parse type body and create UnknownType definition.
      *
+     * @param moduleName
+     *            name of current module
      * @param typedefQName
      *            qname of current type
      * @param ctx
@@ -1015,7 +1036,7 @@ public final class ParserListenerUtils {
      * @param parent
      * @return UnknownType object with constraints from parsed type body
      */
-    public static TypeDefinition<?> parseUnknownTypeWithBody(final QName typedefQName,
+    public static TypeDefinition<?> parseUnknownTypeWithBody(final String moduleName, final QName typedefQName,
             final Type_body_stmtsContext ctx, final List<String> actualPath, final URI namespace, final Date revision,
             final String prefix, final Builder parent) {
         String typeName = typedefQName.getLocalName();
@@ -1026,7 +1047,7 @@ public final class ParserListenerUtils {
             List<RangeConstraint> rangeStatements = getRangeConstraints(ctx);
             List<LengthConstraint> lengthStatements = getLengthConstraints(ctx);
             List<PatternConstraint> patternStatements = getPatternConstraint(ctx);
-            Integer fractionDigits = getFractionDigits(ctx);
+            Integer fractionDigits = getFractionDigits(ctx, moduleName);
 
             if (parent instanceof TypeDefinitionBuilder) {
                 TypeDefinitionBuilder typedef = (TypeDefinitionBuilder) parent;
@@ -1083,7 +1104,7 @@ public final class ParserListenerUtils {
         final int line = typeBody.getStart().getLine();
         TypeDefinition<?> baseType = null;
 
-        Integer fractionDigits = getFractionDigits(typeBody);
+        Integer fractionDigits = getFractionDigits(typeBody, moduleName);
         List<LengthConstraint> lengthStatements = getLengthConstraints(typeBody);
         List<PatternConstraint> patternStatements = getPatternConstraint(typeBody);
         List<RangeConstraint> rangeStatements = getRangeConstraints(typeBody);
@@ -1116,8 +1137,8 @@ public final class ParserListenerUtils {
             } else if ("int64".equals(typeName)) {
                 intType = new Int64(baseTypePath);
             }
-            if(intType == null) {
-                throw new YangParseException(moduleName, line, "Unknown yang type "+ typeName);
+            if (intType == null) {
+                throw new YangParseException(moduleName, line, "Unknown yang type " + typeName);
             }
             constraints.addRanges(intType.getRangeStatements());
             baseType = intType;
@@ -1132,8 +1153,8 @@ public final class ParserListenerUtils {
             } else if ("uint64".equals(typeName)) {
                 uintType = new Uint64(baseTypePath);
             }
-            if(uintType == null) {
-                throw new YangParseException(moduleName, line, "Unknown yang type "+ typeName);
+            if (uintType == null) {
+                throw new YangParseException(moduleName, line, "Unknown yang type " + typeName);
             }
             constraints.addRanges(uintType.getRangeStatements());
             baseType = uintType;
@@ -1158,7 +1179,7 @@ public final class ParserListenerUtils {
             baseType = binaryType;
         } else if ("instance-identifier".equals(typeName)) {
             boolean requireInstance = isRequireInstance(typeBody);
-            baseType = new InstanceIdentifier(baseTypePath, null, requireInstance);
+            return new InstanceIdentifier(baseTypePath, null, requireInstance);
         }
 
         if (parent instanceof TypeDefinitionBuilder && !(parent instanceof UnionTypeBuilder)) {
@@ -1261,16 +1282,21 @@ public final class ParserListenerUtils {
     private static boolean isRequireInstance(Type_body_stmtsContext ctx) {
         for (int i = 0; i < ctx.getChildCount(); i++) {
             ParseTree child = ctx.getChild(i);
-            if (child instanceof Require_instance_stmtContext) {
+            if (child instanceof Instance_identifier_specificationContext) {
                 for (int j = 0; j < child.getChildCount(); j++) {
-                    ParseTree reqArg = child.getChild(j);
-                    if (reqArg instanceof Require_instance_argContext) {
-                        return Boolean.valueOf(stringFromNode(reqArg));
+                    ParseTree reqStmt = child.getChild(j);
+                    if (reqStmt instanceof Require_instance_stmtContext) {
+                        for (int k = 0; k < reqStmt.getChildCount(); k++) {
+                            ParseTree reqArg = reqStmt.getChild(k);
+                            if (reqArg instanceof Require_instance_argContext) {
+                                return Boolean.valueOf(stringFromNode(reqArg));
+                            }
+                        }
                     }
                 }
             }
         }
-        return false;
+        return true;
     }
 
     /**
@@ -1381,8 +1407,8 @@ public final class ParserListenerUtils {
     private static Integer parseMinElements(Min_elements_stmtContext ctx) {
         Integer result = null;
         try {
-            for (int j = 0; j < ctx.getChildCount(); j++) {
-                ParseTree minArg = ctx.getChild(j);
+            for (int i = 0; i < ctx.getChildCount(); i++) {
+                ParseTree minArg = ctx.getChild(i);
                 if (minArg instanceof Min_value_argContext) {
                     result = Integer.valueOf(stringFromNode(minArg));
                 }
@@ -1399,8 +1425,8 @@ public final class ParserListenerUtils {
     private static Integer parseMaxElements(Max_elements_stmtContext ctx) {
         Integer result = null;
         try {
-            for (int j = 0; j < ctx.getChildCount(); j++) {
-                ParseTree maxArg = ctx.getChild(j);
+            for (int i = 0; i < ctx.getChildCount(); i++) {
+                ParseTree maxArg = ctx.getChild(i);
                 if (maxArg instanceof Max_value_argContext) {
                     result = Integer.valueOf(stringFromNode(maxArg));
                 }
@@ -1423,11 +1449,11 @@ public final class ParserListenerUtils {
      */
     public static boolean parseYinValue(Argument_stmtContext ctx) {
         boolean yinValue = false;
-        outer: for (int j = 0; j < ctx.getChildCount(); j++) {
-            ParseTree yin = ctx.getChild(j);
+        outer: for (int i = 0; i < ctx.getChildCount(); i++) {
+            ParseTree yin = ctx.getChild(i);
             if (yin instanceof Yin_element_stmtContext) {
-                for (int k = 0; k < yin.getChildCount(); k++) {
-                    ParseTree yinArg = yin.getChild(k);
+                for (int j = 0; j < yin.getChildCount(); j++) {
+                    ParseTree yinArg = yin.getChild(j);
                     if (yinArg instanceof Yin_element_argContext) {
                         String yinString = stringFromNode(yinArg);
                         if ("true".equals(yinString)) {
@@ -1478,18 +1504,16 @@ public final class ParserListenerUtils {
      *
      * @param refineCtx
      *            refine statement
-     * @param line
-     *            current line in yang model
      * @return RefineHolder object representing this refine statement
      */
     public static RefineHolder parseRefine(Refine_stmtContext refineCtx) {
         final String refineTarget = stringFromNode(refineCtx);
         final RefineHolder refine = new RefineHolder(refineCtx.getStart().getLine(), refineTarget);
-        for (int j = 0; j < refineCtx.getChildCount(); j++) {
-            ParseTree refinePom = refineCtx.getChild(j);
+        for (int i = 0; i < refineCtx.getChildCount(); i++) {
+            ParseTree refinePom = refineCtx.getChild(i);
             if (refinePom instanceof Refine_pomContext) {
-                for (int k = 0; k < refinePom.getChildCount(); k++) {
-                    ParseTree refineStmt = refinePom.getChild(k);
+                for (int j = 0; j < refinePom.getChildCount(); j++) {
+                    ParseTree refineStmt = refinePom.getChild(j);
                     parseRefineDefault(refine, refineStmt);
 
                     if (refineStmt instanceof Refine_leaf_stmtsContext) {
@@ -1551,8 +1575,8 @@ public final class ParserListenerUtils {
     }
 
     private static RefineHolder parseRefine(RefineHolder refine, Refine_container_stmtsContext refineStmt) {
-        for (int m = 0; m < refineStmt.getChildCount(); m++) {
-            ParseTree refineArg = refineStmt.getChild(m);
+        for (int i = 0; i < refineStmt.getChildCount(); i++) {
+            ParseTree refineArg = refineStmt.getChild(i);
             if (refineArg instanceof Must_stmtContext) {
                 MustDefinition must = parseMust((Must_stmtContext) refineArg);
                 refine.setMust(must);
@@ -1564,8 +1588,8 @@ public final class ParserListenerUtils {
     }
 
     private static RefineHolder parseRefine(RefineHolder refine, Refine_list_stmtsContext refineStmt) {
-        for (int m = 0; m < refineStmt.getChildCount(); m++) {
-            ParseTree refineArg = refineStmt.getChild(m);
+        for (int i = 0; i < refineStmt.getChildCount(); i++) {
+            ParseTree refineArg = refineStmt.getChild(i);
             if (refineArg instanceof Must_stmtContext) {
                 MustDefinition must = parseMust((Must_stmtContext) refineArg);
                 refine.setMust(must);
@@ -1581,8 +1605,8 @@ public final class ParserListenerUtils {
     }
 
     private static RefineHolder parseRefine(RefineHolder refine, Refine_leaf_list_stmtsContext refineStmt) {
-        for (int m = 0; m < refineStmt.getChildCount(); m++) {
-            ParseTree refineArg = refineStmt.getChild(m);
+        for (int i = 0; i < refineStmt.getChildCount(); i++) {
+            ParseTree refineArg = refineStmt.getChild(i);
             if (refineArg instanceof Must_stmtContext) {
                 MustDefinition must = parseMust((Must_stmtContext) refineArg);
                 refine.setMust(must);
index 87075e2..587c8be 100644 (file)
@@ -386,7 +386,7 @@ public final class ParserUtils {
      */
     public static Builder findRefineTargetBuilder(final GroupingBuilder grouping, final String refineNodeName) {
         // search child nodes
-        Builder result = grouping.getChildNode(refineNodeName);
+        Builder result = grouping.getDataChildByName(refineNodeName);
         // search groupings
         if (result == null) {
             Set<GroupingBuilder> grps = grouping.getGroupingBuilders();
index 1f5e294..44bb56b 100644 (file)
@@ -12,10 +12,9 @@ import java.util.List;
 
 import org.opendaylight.controller.yang.model.api.MustDefinition;
 import org.opendaylight.controller.yang.parser.builder.api.Builder;
-import org.opendaylight.controller.yang.parser.builder.api.ConfigNode;
 import org.opendaylight.controller.yang.parser.builder.impl.UnknownSchemaNodeBuilder;
 
-public final class RefineHolder implements Builder, ConfigNode {
+public final class RefineHolder implements Builder {
     private Builder parent;
     private final int line;
     private final String name;
@@ -74,12 +73,10 @@ public final class RefineHolder implements Builder, ConfigNode {
         this.reference = reference;
     }
 
-    @Override
     public Boolean isConfiguration() {
         return config;
     }
 
-    @Override
     public void setConfiguration(final Boolean config) {
         this.config = config;
     }
@@ -128,11 +125,13 @@ public final class RefineHolder implements Builder, ConfigNode {
         return name;
     }
 
-    public List<UnknownSchemaNodeBuilder> getUnknownNodes() {
+    @Override
+    public List<UnknownSchemaNodeBuilder> getUnknownNodeBuilders() {
         return addedUnknownNodes;
     }
 
-    public void addUnknownSchemaNode(UnknownSchemaNodeBuilder unknownNode) {
+    @Override
+    public void addUnknownNodeBuilder(UnknownSchemaNodeBuilder unknownNode) {
         addedUnknownNodes.add(unknownNode);
     }
 
index 73acebf..69c90ca 100644 (file)
@@ -131,7 +131,7 @@ public class RefineUtils {
         String defaultStr = refine.getDefaultStr();
         Boolean mandatory = refine.isMandatory();
         MustDefinition must = refine.getMust();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
+        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodeBuilders();
 
         if (defaultStr != null && !("".equals(defaultStr))) {
             leaf.setDefaultStr(defaultStr);
@@ -144,7 +144,7 @@ public class RefineUtils {
         }
         if (unknownNodes != null) {
             for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                leaf.addUnknownSchemaNode(unknown);
+                leaf.addUnknownNodeBuilder(unknown);
             }
         }
     }
@@ -152,7 +152,7 @@ public class RefineUtils {
     public static void refineContainer(ContainerSchemaNodeBuilder container, RefineHolder refine, int line) {
         Boolean presence = refine.isPresence();
         MustDefinition must = refine.getMust();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
+        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodeBuilders();
 
         if (presence != null) {
             container.setPresence(presence);
@@ -162,7 +162,7 @@ public class RefineUtils {
         }
         if (unknownNodes != null) {
             for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                container.addUnknownSchemaNode(unknown);
+                container.addUnknownNodeBuilder(unknown);
             }
         }
     }
@@ -171,7 +171,7 @@ public class RefineUtils {
         MustDefinition must = refine.getMust();
         Integer min = refine.getMinElements();
         Integer max = refine.getMaxElements();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
+        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodeBuilders();
 
         if (must != null) {
             list.getConstraints().addMustDefinition(must);
@@ -184,7 +184,7 @@ public class RefineUtils {
         }
         if (unknownNodes != null) {
             for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                list.addUnknownSchemaNode(unknown);
+                list.addUnknownNodeBuilder(unknown);
             }
         }
     }
@@ -193,7 +193,7 @@ public class RefineUtils {
         MustDefinition must = refine.getMust();
         Integer min = refine.getMinElements();
         Integer max = refine.getMaxElements();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
+        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodeBuilders();
 
         if (must != null) {
             leafList.getConstraints().addMustDefinition(must);
@@ -206,7 +206,7 @@ public class RefineUtils {
         }
         if (unknownNodes != null) {
             for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                leafList.addUnknownSchemaNode(unknown);
+                leafList.addUnknownNodeBuilder(unknown);
             }
         }
     }
@@ -214,7 +214,7 @@ public class RefineUtils {
     public static void refineChoice(ChoiceBuilder choice, RefineHolder refine, int line) {
         String defaultStr = refine.getDefaultStr();
         Boolean mandatory = refine.isMandatory();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
+        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodeBuilders();
 
         if (defaultStr != null) {
             choice.setDefaultCase(defaultStr);
@@ -224,7 +224,7 @@ public class RefineUtils {
         }
         if (unknownNodes != null) {
             for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                choice.addUnknownSchemaNode(unknown);
+                choice.addUnknownNodeBuilder(unknown);
             }
         }
     }
@@ -232,7 +232,7 @@ public class RefineUtils {
     public static void refineAnyxml(AnyXmlBuilder anyXml, RefineHolder refine, int line) {
         Boolean mandatory = refine.isMandatory();
         MustDefinition must = refine.getMust();
-        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodes();
+        List<UnknownSchemaNodeBuilder> unknownNodes = refine.getUnknownNodeBuilders();
 
         if (mandatory != null) {
             anyXml.getConstraints().setMandatory(mandatory);
@@ -242,7 +242,7 @@ public class RefineUtils {
         }
         if (unknownNodes != null) {
             for (UnknownSchemaNodeBuilder unknown : unknownNodes) {
-                anyXml.addUnknownSchemaNode(unknown);
+                anyXml.addUnknownNodeBuilder(unknown);
             }
         }
     }
index 2c910ce..8f49fec 100644 (file)
@@ -39,8 +39,7 @@ public class TypesResolutionTest {
 
     @Before
     public void init() throws FileNotFoundException {
-        testedModules = TestUtils.loadModules(getClass().getResource
-                ("/types").getPath());
+        testedModules = TestUtils.loadModules(getClass().getResource("/types").getPath());
     }
 
     @Test
@@ -50,10 +49,8 @@ public class TypesResolutionTest {
         assertEquals(14, typedefs.size());
 
         TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-version");
-        assertTrue(type.getDescription().contains(
-                "This value represents the version of the IP protocol."));
-        assertTrue(type.getReference().contains(
-                "RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"));
+        assertTrue(type.getDescription().contains("This value represents the version of the IP protocol."));
+        assertTrue(type.getReference().contains("RFC 2460: Internet Protocol, Version 6 (IPv6) Specification"));
 
         EnumerationType enumType = (EnumerationType) type.getBaseType();
         List<EnumPair> values = enumType.getValues();
@@ -62,27 +59,22 @@ public class TypesResolutionTest {
         EnumPair value0 = values.get(0);
         assertEquals("unknown", value0.getName());
         assertEquals(0, (int) value0.getValue());
-        assertEquals(
-                "An unknown or unspecified version of the Internet protocol.",
-                value0.getDescription());
+        assertEquals("An unknown or unspecified version of the Internet protocol.", value0.getDescription());
 
         EnumPair value1 = values.get(1);
         assertEquals("ipv4", value1.getName());
         assertEquals(1, (int) value1.getValue());
-        assertEquals("The IPv4 protocol as defined in RFC 791.",
-                value1.getDescription());
+        assertEquals("The IPv4 protocol as defined in RFC 791.", value1.getDescription());
 
         EnumPair value2 = values.get(2);
         assertEquals("ipv6", value2.getName());
         assertEquals(2, (int) value2.getValue());
-        assertEquals("The IPv6 protocol as defined in RFC 2460.",
-                value2.getDescription());
+        assertEquals("The IPv6 protocol as defined in RFC 2460.", value2.getDescription());
     }
 
     @Test
     public void testEnumeration() {
-        Module tested = TestUtils
-                .findModule(testedModules, "custom-types-test");
+        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
 
         TypeDefinition<?> type = TestUtils.findTypedef(typedefs, "ip-version");
@@ -93,21 +85,17 @@ public class TypesResolutionTest {
         EnumPair value0 = values.get(0);
         assertEquals("unknown", value0.getName());
         assertEquals(0, (int) value0.getValue());
-        assertEquals(
-                "An unknown or unspecified version of the Internet protocol.",
-                value0.getDescription());
+        assertEquals("An unknown or unspecified version of the Internet protocol.", value0.getDescription());
 
         EnumPair value1 = values.get(1);
         assertEquals("ipv4", value1.getName());
         assertEquals(19, (int) value1.getValue());
-        assertEquals("The IPv4 protocol as defined in RFC 791.",
-                value1.getDescription());
+        assertEquals("The IPv4 protocol as defined in RFC 791.", value1.getDescription());
 
         EnumPair value2 = values.get(2);
         assertEquals("ipv6", value2.getName());
         assertEquals(7, (int) value2.getValue());
-        assertEquals("The IPv6 protocol as defined in RFC 2460.",
-                value2.getDescription());
+        assertEquals("The IPv6 protocol as defined in RFC 2460.", value2.getDescription());
 
         EnumPair value3 = values.get(3);
         assertEquals("default", value3.getName());
@@ -126,10 +114,8 @@ public class TypesResolutionTest {
         ExtendedType ipv4 = (ExtendedType) unionTypes.get(0);
         assertTrue(ipv4.getBaseType() instanceof StringTypeDefinition);
         String expectedPattern = "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}"
-                + "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"
-                + "(%[\\p{N}\\p{L}]+)?";
-        assertEquals(expectedPattern, ipv4.getPatterns().get(0)
-                .getRegularExpression());
+                + "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" + "(%[\\p{N}\\p{L}]+)?";
+        assertEquals(expectedPattern, ipv4.getPatterns().get(0).getRegularExpression());
 
         TypeDefinition<?> ipv4Address = TestUtils.findTypedef(typedefs, "ipv4-address");
         assertEquals(ipv4Address, ipv4);
@@ -138,33 +124,28 @@ public class TypesResolutionTest {
         assertTrue(ipv6.getBaseType() instanceof StringTypeDefinition);
         List<PatternConstraint> ipv6Patterns = ipv6.getPatterns();
         expectedPattern = "((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}"
-                + "((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|"
-                + "(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}"
-                + "(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))"
-                + "(%[\\p{N}\\p{L}]+)?";
-        assertEquals(expectedPattern, ipv6Patterns.get(0)
-                .getRegularExpression());
+                + "((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|" + "(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}"
+                + "(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))" + "(%[\\p{N}\\p{L}]+)?";
+        assertEquals(expectedPattern, ipv6Patterns.get(0).getRegularExpression());
 
         TypeDefinition<?> ipv6Address = TestUtils.findTypedef(typedefs, "ipv6-address");
         assertEquals(ipv6Address, ipv6);
 
-        expectedPattern = "(([^:]+:){6}(([^:]+:[^:]+)|(.*\\..*)))|"
-                + "((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)" + "(%.+)?";
-        assertEquals(expectedPattern, ipv6Patterns.get(1)
-                .getRegularExpression());
+        expectedPattern = "(([^:]+:){6}(([^:]+:[^:]+)|(.*\\..*)))|" + "((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)"
+                + "(%.+)?";
+        assertEquals(expectedPattern, ipv6Patterns.get(1).getRegularExpression());
     }
 
     @Test
     public void testDomainName() {
         Module tested = TestUtils.findModule(testedModules, "ietf-inet-types");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        ExtendedType type = (ExtendedType)TestUtils.findTypedef(typedefs, "domain-name");
+        ExtendedType type = (ExtendedType) TestUtils.findTypedef(typedefs, "domain-name");
         assertTrue(type.getBaseType() instanceof StringTypeDefinition);
         List<PatternConstraint> patterns = type.getPatterns();
         assertEquals(1, patterns.size());
         String expectedPattern = "((([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.)*"
-                + "([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.?)"
-                + "|\\.";
+                + "([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.?)" + "|\\.";
         assertEquals(expectedPattern, patterns.get(0).getRegularExpression());
 
         List<LengthConstraint> lengths = type.getLengths();
@@ -176,38 +157,30 @@ public class TypesResolutionTest {
 
     @Test
     public void testInstanceIdentifier1() {
-        Module tested = TestUtils
-                .findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested
-                .getDataChildByName("inst-id-leaf1");
-        ExtendedType leafType = (ExtendedType) leaf.getType();
-        InstanceIdentifier leafTypeBase = (InstanceIdentifier) leafType
-                .getBaseType();
-        assertFalse(leafTypeBase.requireInstance());
+        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
+        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf1");
+        InstanceIdentifier leafType = (InstanceIdentifier) leaf.getType();
+        assertFalse(leafType.requireInstance());
     }
 
     @Test
     public void testInstanceIdentifier2() {
-        Module tested = TestUtils
-                .findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested
-                .getDataChildByName("inst-id-leaf2");
+        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
+        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("inst-id-leaf2");
         InstanceIdentifier leafType = (InstanceIdentifier) leaf.getType();
         assertTrue(leafType.requireInstance());
     }
 
     @Test
     public void testIdentity() {
-        Module tested = TestUtils
-                .findModule(testedModules, "custom-types-test");
+        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
         Set<IdentitySchemaNode> identities = tested.getIdentities();
         IdentitySchemaNode testedIdentity = null;
         for (IdentitySchemaNode id : identities) {
             if (id.getQName().getLocalName().equals("crypto-alg")) {
                 testedIdentity = id;
                 IdentitySchemaNode baseIdentity = id.getBaseIdentity();
-                assertEquals("crypto-base", baseIdentity.getQName()
-                        .getLocalName());
+                assertEquals("crypto-base", baseIdentity.getQName().getLocalName());
                 assertNull(baseIdentity.getBaseIdentity());
             }
         }
@@ -216,10 +189,8 @@ public class TypesResolutionTest {
 
     @Test
     public void testBitsType1() {
-        Module tested = TestUtils
-                .findModule(testedModules, "custom-types-test");
-        LeafSchemaNode leaf = (LeafSchemaNode) tested
-                .getDataChildByName("mybits");
+        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
+        LeafSchemaNode leaf = (LeafSchemaNode) tested.getDataChildByName("mybits");
         BitsType leafType = (BitsType) leaf.getType();
         List<Bit> bits = leafType.getBits();
         assertEquals(3, bits.size());
@@ -239,11 +210,9 @@ public class TypesResolutionTest {
 
     @Test
     public void testBitsType2() {
-        Module tested = TestUtils
-                .findModule(testedModules, "custom-types-test");
+        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs,
-                "access-operations-type");
+        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "access-operations-type");
 
         BitsType bitsType = (BitsType) testedType.getBaseType();
         List<Bit> bits = bitsType.getBits();
@@ -269,8 +238,7 @@ public class TypesResolutionTest {
     public void testIanaTimezones() {
         Module tested = TestUtils.findModule(testedModules, "iana-timezones");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs,
-                "iana-timezone");
+        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "iana-timezone");
 
         String expectedDesc = "A timezone location as defined by the IANA timezone";
         assertTrue(testedType.getDescription().contains(expectedDesc));
@@ -278,10 +246,8 @@ public class TypesResolutionTest {
         assertEquals(Status.CURRENT, testedType.getStatus());
 
         QName testedTypeQName = testedType.getQName();
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:iana-timezones"),
-                testedTypeQName.getNamespace());
-        assertEquals(TestUtils.createDate("2012-07-09"),
-                testedTypeQName.getRevision());
+        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:iana-timezones"), testedTypeQName.getNamespace());
+        assertEquals(TestUtils.createDate("2012-07-09"), testedTypeQName.getRevision());
         assertEquals("ianatz", testedTypeQName.getPrefix());
         assertEquals("iana-timezone", testedTypeQName.getLocalName());
 
@@ -292,22 +258,19 @@ public class TypesResolutionTest {
         EnumPair enum168 = values.get(168);
         assertEquals("America/Danmarkshavn", enum168.getName());
         assertEquals(168, (int) enum168.getValue());
-        assertEquals("east coast, north of Scoresbysund",
-                enum168.getDescription());
+        assertEquals("east coast, north of Scoresbysund", enum168.getDescription());
 
         EnumPair enum374 = values.get(374);
         assertEquals("America/Indiana/Winamac", enum374.getName());
         assertEquals(374, (int) enum374.getValue());
-        assertEquals("Eastern Time - Indiana - Pulaski County",
-                enum374.getDescription());
+        assertEquals("Eastern Time - Indiana - Pulaski County", enum374.getDescription());
     }
 
     @Test
     public void testObjectId128() {
         Module tested = TestUtils.findModule(testedModules, "ietf-yang-types");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        ExtendedType testedType = (ExtendedType) TestUtils.findTypedef(
-                typedefs, "object-identifier-128");
+        ExtendedType testedType = (ExtendedType) TestUtils.findTypedef(typedefs, "object-identifier-128");
 
         List<PatternConstraint> patterns = testedType.getPatterns();
         assertEquals(1, patterns.size());
@@ -315,10 +278,8 @@ public class TypesResolutionTest {
         assertEquals("\\d*(\\.\\d*){1,127}", pattern.getRegularExpression());
 
         QName testedTypeQName = testedType.getQName();
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types"),
-                testedTypeQName.getNamespace());
-        assertEquals(TestUtils.createDate("2010-09-24"),
-                testedTypeQName.getRevision());
+        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types"), testedTypeQName.getNamespace());
+        assertEquals(TestUtils.createDate("2010-09-24"), testedTypeQName.getRevision());
         assertEquals("yang", testedTypeQName.getPrefix());
         assertEquals("object-identifier-128", testedTypeQName.getLocalName());
 
@@ -327,30 +288,24 @@ public class TypesResolutionTest {
         assertEquals(1, patterns.size());
 
         pattern = patterns.get(0);
-        assertEquals(
-                "(([0-1](\\.[1-3]?[0-9]))|(2\\.(0|([1-9]\\d*))))(\\.(0|([1-9]\\d*)))*",
+        assertEquals("(([0-1](\\.[1-3]?[0-9]))|(2\\.(0|([1-9]\\d*))))(\\.(0|([1-9]\\d*)))*",
                 pattern.getRegularExpression());
 
         QName testedTypeBaseQName = testedTypeBase.getQName();
-        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types"),
-                testedTypeBaseQName.getNamespace());
-        assertEquals(TestUtils.createDate("2010-09-24"),
-                testedTypeBaseQName.getRevision());
+        assertEquals(URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types"), testedTypeBaseQName.getNamespace());
+        assertEquals(TestUtils.createDate("2010-09-24"), testedTypeBaseQName.getRevision());
         assertEquals("yang", testedTypeBaseQName.getPrefix());
         assertEquals("object-identifier", testedTypeBaseQName.getLocalName());
     }
 
     @Test
     public void testIdentityref() {
-        Module tested = TestUtils
-                .findModule(testedModules, "custom-types-test");
+        Module tested = TestUtils.findModule(testedModules, "custom-types-test");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
-        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs,
-                "service-type-ref");
+        TypeDefinition<?> testedType = TestUtils.findTypedef(typedefs, "service-type-ref");
         IdentityrefType baseType = (IdentityrefType) testedType.getBaseType();
         QName identity = baseType.getIdentity();
-        assertEquals(URI.create("urn:simple.container.demo"),
-                identity.getNamespace());
+        assertEquals(URI.create("urn:simple.container.demo"), identity.getNamespace());
         assertEquals(TestUtils.createDate("2012-04-16"), identity.getRevision());
         assertEquals("iit", identity.getPrefix());
         assertEquals("service-type", identity.getLocalName());