Fix license header violations in yang-parser-impl
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / builder / api / DataNodeContainerBuilder.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.builder.api;
9
10 import java.util.List;
11 import java.util.Map;
12 import java.util.Set;
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;
19
20 /**
21  * Common builder for for all YANG {@link DataNodeContainer}
22  * <code>augment, case, container,
23  * grouping, list, module, notification</code>.
24  */
25 public interface DataNodeContainerBuilder extends Builder {
26
27     /**
28      * Returns QName of this node.
29      *
30      * @return QName of this node
31      */
32     QName getQName();
33
34     /**
35      * Returns Schema path of this node.
36      *
37      * @return SchemaPath of this node
38      */
39     SchemaPath getPath();
40
41     /**
42      * Returns list of of child node builders in order they are declared in yang
43      * file.
44      *
45      * This child node builder are build, during invoking {@link #build()} and
46      * added as children to resulting {@link DataNodeContainer}.
47      *
48      * @return collection child nodes builders
49      */
50     List<DataSchemaNodeBuilder> getChildNodeBuilders();
51
52     /**
53      * Retrieves child node builder by local name.
54      *
55      * @param name
56      *            name of child to seek
57      * @return child node with given name if present, null otherwise
58      */
59     DataSchemaNodeBuilder getDataChildByName(String name);
60
61     /**
62      * Add builder of child node to this node.
63      *
64      * @param childNode
65      */
66     void addChildNode(DataSchemaNodeBuilder childNode);
67
68     /**
69      * Add builder of child node to this node at specified position.
70      *
71      * @param childNode
72      */
73     void addChildNode(int index, DataSchemaNodeBuilder childNode);
74
75     void addChildNode(DataSchemaNode childNode);
76
77     void addChildNodeToContext(DataSchemaNodeBuilder childNode);
78
79     /**
80      * Get already built groupings defined in this node.
81      *
82      * @return collection of GroupingDefinition objects
83      */
84     Set<GroupingDefinition> getGroupings();
85
86     /**
87      * Get builders of groupings defined in this node.
88      *
89      * @return collection of grouping builders
90      */
91     Set<GroupingBuilder> getGroupingBuilders();
92
93     /**
94      * Add builder of grouping statement to this node.
95      *
96      * @param groupingBuilder
97      */
98     void addGrouping(GroupingBuilder groupingBuilder);
99
100     /**
101      * Get builders of uses defined in this node.
102      *
103      * @return collection of uses builders
104      */
105     List<UsesNodeBuilder> getUsesNodeBuilders();
106
107     /**
108      * Add builder of uses statement to this node.
109      *
110      * @param usesBuilder
111      */
112     void addUsesNode(UsesNodeBuilder usesBuilder);
113
114     /**
115      * Returns set of already built type definitions.
116      *
117      * @return set of already built type definitions.
118      */
119     Set<TypeDefinition<?>> getTypeDefinitions();
120
121     /**
122      * Returns builders of typedef statement defined in this node.
123      *
124      * @return builders of typedef statement defined in this node.
125      */
126     Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
127
128     /**
129      * Add typedef builder to this node.
130      *
131      * @param typedefBuilder
132      *            Builder to add to this node.
133      */
134     void addTypedef(TypeDefinitionBuilder typedefBuilder);
135
136     /**
137      * Returns an instance of product - DataNodeContainer
138      *
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.
142      *
143      * @return Instance of DataNodeContainer
144      */
145     @Override
146     DataNodeContainer build();
147
148     /**
149      * Returns map of child nodes of this node. Child nodes should be in same
150      * order as they were defined in yang file.
151      *
152      * @return map of child nodes of this node
153      */
154     Map<QName, DataSchemaNode> getChildNodes();
155
156 }