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.
66 void addChildNode(DataSchemaNodeBuilder childNode);
69 * Add builder of child node to this node at specified position.
73 void addChildNode(int index, DataSchemaNodeBuilder childNode);
75 void addChildNode(DataSchemaNode childNode);
77 void addChildNodeToContext(DataSchemaNodeBuilder childNode);
80 * Get already built groupings defined in this node.
82 * @return collection of GroupingDefinition objects
84 Set<GroupingDefinition> getGroupings();
87 * Get builders of groupings defined in this node.
89 * @return collection of grouping builders
91 Set<GroupingBuilder> getGroupingBuilders();
94 * Add builder of grouping statement to this node.
96 * @param groupingBuilder
98 void addGrouping(GroupingBuilder groupingBuilder);
101 * Get builders of uses defined in this node.
103 * @return collection of uses builders
105 List<UsesNodeBuilder> getUsesNodeBuilders();
108 * Add builder of uses statement to this node.
112 void addUsesNode(UsesNodeBuilder usesBuilder);
115 * Returns set of already built type definitions.
117 * @return set of already built type definitions.
119 Set<TypeDefinition<?>> getTypeDefinitions();
122 * Returns builders of typedef statement defined in this node.
124 * @return builders of typedef statement defined in this node.
126 Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
129 * Add typedef builder to this node.
131 * @param typedefBuilder
132 * Builder to add to this node.
134 void addTypedef(TypeDefinitionBuilder typedefBuilder);
137 * Returns an instance of product - DataNodeContainer
139 * Returns an instance of data node container with children and properties
140 * constructed as per this builder state, all nested builders are also built
141 * and their product is set to DataNodeContainer.
143 * @return Instance of DataNodeContainer
146 DataNodeContainer build();
149 * Returns map of child nodes of this node. Child nodes should be in same
150 * order as they were defined in yang file.
152 * @return map of child nodes of this node
154 Map<QName, DataSchemaNode> getChildNodes();