2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.parser.builder.api;
10 import java.util.List;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
15 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
17 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
18 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
21 * Common builder for for all YANG {@link DataNodeContainer}
22 * <code>augment, case, container,
23 * grouping, list, module, notification</code>.
25 public interface DataNodeContainerBuilder extends Builder {
28 * Returns QName of this node.
30 * @return QName of this node
35 * Returns Schema path of this node.
37 * @return SchemaPath of this node
42 * Returns list of of child node builders in order they are declared in yang
45 * This child node builder are build, during invoking {@link #build()} and
46 * added as children to resulting {@link DataNodeContainer}.
48 * @return collection child nodes builders
50 List<DataSchemaNodeBuilder> getChildNodeBuilders();
53 * Retrieves child node builder by local name.
56 * name of child to seek
57 * @return child node with given name if present, null otherwise
59 DataSchemaNodeBuilder getDataChildByName(String name);
62 * Add builder of child node to this node.
64 * @param childNode name of child node to add
66 void addChildNode(DataSchemaNodeBuilder childNode);
69 * Add builder of child node to this node at specified position.
71 * @param index position at which the child node will be added
72 * @param childNode name of child node to add at specified position
74 void addChildNode(int index, DataSchemaNodeBuilder childNode);
76 void addChildNode(DataSchemaNode childNode);
78 void addChildNodeToContext(DataSchemaNodeBuilder childNode);
81 * Get already built groupings defined in this node.
83 * @return collection of GroupingDefinition objects
85 Set<GroupingDefinition> getGroupings();
88 * Get builders of groupings defined in this node.
90 * @return collection of grouping builders
92 Set<GroupingBuilder> getGroupingBuilders();
95 * Add builder of grouping statement to this node.
97 * @param groupingBuilder grouping statement builder
99 void addGrouping(GroupingBuilder groupingBuilder);
102 * Get builders of uses defined in this node.
104 * @return collection of uses builders
106 List<UsesNodeBuilder> getUsesNodeBuilders();
109 * Add builder of uses statement to this node.
111 * @param usesBuilder uses statement builder
113 void addUsesNode(UsesNodeBuilder usesBuilder);
116 * Returns set of already built type definitions.
118 * @return set of already built type definitions.
120 Set<TypeDefinition<?>> getTypeDefinitions();
123 * Returns builders of typedef statement defined in this node.
125 * @return builders of typedef statement defined in this node.
127 Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
130 * Add typedef builder to this node.
132 * @param typedefBuilder
133 * Builder to add to this node.
135 void addTypedef(TypeDefinitionBuilder typedefBuilder);
138 * Returns an instance of product - DataNodeContainer
140 * Returns an instance of data node container with children and properties
141 * constructed as per this builder state, all nested builders are also built
142 * and their product is set to DataNodeContainer.
144 * @return Instance of DataNodeContainer
147 DataNodeContainer build();
150 * Returns map of child nodes of this node. Child nodes should be in same
151 * order as they were defined in yang file.
153 * @return map of child nodes of this node
155 Map<QName, DataSchemaNode> getChildNodes();