BUG-979: reworked data schema nodes ordering
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / api / DataNodeContainerBuilder.java
index 2d451da501dfe4e0e3cd45fbdcf24ad2a7250b6f..466af6a61462d6efe2153e63554703462b0e5e81 100644 (file)
@@ -6,6 +6,7 @@
  */
 package org.opendaylight.yangtools.yang.parser.builder.api;
 
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -37,14 +38,15 @@ public interface DataNodeContainerBuilder extends Builder {
     SchemaPath getPath();
 
     /**
-     * Returns set of of child node builders.
+     * Returns list of of child node builders in order they are declared in yang
+     * file.
      *
      * This child node builder are build, during invoking {@link #build()} and
      * added as children to resulting {@link DataNodeContainer}.
      *
      * @return collection child nodes builders
      */
-    Set<DataSchemaNodeBuilder> getChildNodeBuilders();
+    List<DataSchemaNodeBuilder> getChildNodeBuilders();
 
     /**
      * Retrieves child node builder by local name.
@@ -62,6 +64,13 @@ public interface DataNodeContainerBuilder extends Builder {
      */
     void addChildNode(DataSchemaNodeBuilder childNode);
 
+    /**
+     * Add builder of child node to this node at specified position.
+     *
+     * @param childNode
+     */
+    void addChildNode(int index, DataSchemaNodeBuilder childNode);
+
     void addChildNode(DataSchemaNode childNode);
 
     void addChildNodeToContext(DataSchemaNodeBuilder childNode);
@@ -92,7 +101,7 @@ public interface DataNodeContainerBuilder extends Builder {
      *
      * @return collection of uses builders
      */
-    Set<UsesNodeBuilder> getUsesNodeBuilders();
+    List<UsesNodeBuilder> getUsesNodeBuilders();
 
     /**
      * Add builder of uses statement to this node.
@@ -111,30 +120,36 @@ public interface DataNodeContainerBuilder extends Builder {
     /**
      * Returns builders of typedef statement defined in this node.
      *
-     * @return  builders of typedef statement defined in this node.
+     * @return builders of typedef statement defined in this node.
      */
     Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
 
     /**
      * Add typedef builder to this node.
      *
-     * @param typedefBuilder Builder to add to this node.
+     * @param typedefBuilder
+     *            Builder to add to this node.
      */
     void addTypedef(TypeDefinitionBuilder typedefBuilder);
 
     /**
      * Returns an instance of product - DataNodeContainer
      *
-     * Returns an instance of data node container with
-     * children and properties constructed as per this builder state,
-     * all nested builders are also built and their product is
-     * set to DataNodeContainer.
+     * Returns an instance of data node container with children and properties
+     * constructed as per this builder state, all nested builders are also built
+     * and their product is set to DataNodeContainer.
      *
      * @return Instance of DataNodeContainer
      */
     @Override
     DataNodeContainer build();
 
+    /**
+     * Returns map of child nodes of this node. Child nodes should be in same
+     * order as they were defined in yang file.
+     *
+     * @return map of child nodes of this node
+     */
     Map<QName, DataSchemaNode> getChildNodes();
 
 }