Merge "Bug 762: Verify input in typedef codecs"
[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  * 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
6  */
7 package org.opendaylight.yangtools.yang.parser.builder.api;
8
9 import java.util.Map;
10 import java.util.Set;
11 import org.opendaylight.yangtools.yang.common.QName;
12 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
13 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
14 import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
15 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
16 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
17
18 /**
19  * Common builder for for all YANG {@link DataNodeContainer}
20  * <code>augment, case, container,
21  * grouping, list, module, notification</code>.
22  */
23 public interface DataNodeContainerBuilder extends Builder {
24
25     /**
26      * Returns QName of this node.
27      *
28      * @return QName of this node
29      */
30     QName getQName();
31
32     /**
33      * Returns Schema path of this node.
34      *
35      * @return SchemaPath of this node
36      */
37     SchemaPath getPath();
38
39     /**
40      * Returns set of of child node builders.
41      *
42      * This child node builder are build, during invoking {@link #build()} and
43      * added as children to resulting {@link DataNodeContainer}.
44      *
45      * @return collection child nodes builders
46      */
47     Set<DataSchemaNodeBuilder> getChildNodeBuilders();
48
49     /**
50      * Retrieves child node builder by local name.
51      *
52      * @param name
53      *            name of child to seek
54      * @return child node with given name if present, null otherwise
55      */
56     DataSchemaNodeBuilder getDataChildByName(String name);
57
58     /**
59      * Add builder of child node to this node.
60      *
61      * @param childNode
62      */
63     void addChildNode(DataSchemaNodeBuilder childNode);
64
65     void addChildNode(DataSchemaNode childNode);
66
67     void addChildNodeToContext(DataSchemaNodeBuilder childNode);
68
69     /**
70      * Get already built groupings defined in this node.
71      *
72      * @return collection of GroupingDefinition objects
73      */
74     Set<GroupingDefinition> getGroupings();
75
76     /**
77      * Get builders of groupings defined in this node.
78      *
79      * @return collection of grouping builders
80      */
81     Set<GroupingBuilder> getGroupingBuilders();
82
83     /**
84      * Add builder of grouping statement to this node.
85      *
86      * @param groupingBuilder
87      */
88     void addGrouping(GroupingBuilder groupingBuilder);
89
90     /**
91      * Get builders of uses defined in this node.
92      *
93      * @return collection of uses builders
94      */
95     Set<UsesNodeBuilder> getUsesNodeBuilders();
96
97     /**
98      * Add builder of uses statement to this node.
99      *
100      * @param usesBuilder
101      */
102     void addUsesNode(UsesNodeBuilder usesBuilder);
103
104     /**
105      * Returns set of already built type definitions.
106      *
107      * @return set of already built type definitions.
108      */
109     Set<TypeDefinition<?>> getTypeDefinitions();
110
111     /**
112      * Returns builders of typedef statement defined in this node.
113      *
114      * @return  builders of typedef statement defined in this node.
115      */
116     Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
117
118     /**
119      * Add typedef builder to this node.
120      *
121      * @param typedefBuilder Builder to add to this node.
122      */
123     void addTypedef(TypeDefinitionBuilder typedefBuilder);
124
125     /**
126      * Returns an instance of product - DataNodeContainer
127      *
128      * Returns an instance of data node container with
129      * children and properties constructed as per this builder state,
130      * all nested builders are also built and their product is
131      * set to DataNodeContainer.
132      *
133      * @return Instance of DataNodeContainer
134      */
135     @Override
136     DataNodeContainer build();
137
138     Map<QName, DataSchemaNode> getChildNodes();
139
140 }