2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
3 * This program and the accompanying materials are made available under the
4 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
5 * and is available at http://www.eclipse.org/legal/epl-v10.html
7 package org.opendaylight.yangtools.yang.parser.builder.api;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
14 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
15 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
16 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
17 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
20 * Common builder for for all YANG {@link DataNodeContainer}
21 * <code>augment, case, container,
22 * grouping, list, module, notification</code>.
24 public interface DataNodeContainerBuilder extends Builder {
27 * Returns QName of this node.
29 * @return QName of this node
34 * Returns Schema path of this node.
36 * @return SchemaPath of this node
41 * Returns list of of child node builders in order they are declared in yang
44 * This child node builder are build, during invoking {@link #build()} and
45 * added as children to resulting {@link DataNodeContainer}.
47 * @return collection child nodes builders
49 List<DataSchemaNodeBuilder> getChildNodeBuilders();
52 * Retrieves child node builder by local name.
55 * name of child to seek
56 * @return child node with given name if present, null otherwise
58 DataSchemaNodeBuilder getDataChildByName(String name);
61 * Add builder of child node to this node.
65 void addChildNode(DataSchemaNodeBuilder childNode);
68 * Add builder of child node to this node at specified position.
72 void addChildNode(int index, DataSchemaNodeBuilder childNode);
74 void addChildNode(DataSchemaNode childNode);
76 void addChildNodeToContext(DataSchemaNodeBuilder childNode);
79 * Get already built groupings defined in this node.
81 * @return collection of GroupingDefinition objects
83 Set<GroupingDefinition> getGroupings();
86 * Get builders of groupings defined in this node.
88 * @return collection of grouping builders
90 Set<GroupingBuilder> getGroupingBuilders();
93 * Add builder of grouping statement to this node.
95 * @param groupingBuilder
97 void addGrouping(GroupingBuilder groupingBuilder);
100 * Get builders of uses defined in this node.
102 * @return collection of uses builders
104 List<UsesNodeBuilder> getUsesNodeBuilders();
107 * Add builder of uses statement to this node.
111 void addUsesNode(UsesNodeBuilder usesBuilder);
114 * Returns set of already built type definitions.
116 * @return set of already built type definitions.
118 Set<TypeDefinition<?>> getTypeDefinitions();
121 * Returns builders of typedef statement defined in this node.
123 * @return builders of typedef statement defined in this node.
125 Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
128 * Add typedef builder to this node.
130 * @param typedefBuilder
131 * Builder to add to this node.
133 void addTypedef(TypeDefinitionBuilder typedefBuilder);
136 * Returns an instance of product - DataNodeContainer
138 * Returns an instance of data node container with children and properties
139 * constructed as per this builder state, all nested builders are also built
140 * and their product is set to DataNodeContainer.
142 * @return Instance of DataNodeContainer
145 DataNodeContainer build();
148 * Returns map of child nodes of this node. Child nodes should be in same
149 * order as they were defined in yang file.
151 * @return map of child nodes of this node
153 Map<QName, DataSchemaNode> getChildNodes();