BUG-865: deprecate pre-Beryllium parser elements
[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  * @deprecated Pre-Beryllium implementation, scheduled for removal.
26  */
27 @Deprecated
28 public interface DataNodeContainerBuilder extends Builder {
29
30     /**
31      * Returns QName of this node.
32      *
33      * @return QName of this node
34      */
35     QName getQName();
36
37     /**
38      * Returns Schema path of this node.
39      *
40      * @return SchemaPath of this node
41      */
42     SchemaPath getPath();
43
44     /**
45      * Returns list of of child node builders in order they are declared in yang
46      * file.
47      *
48      * This child node builder are build, during invoking {@link #build()} and
49      * added as children to resulting {@link DataNodeContainer}.
50      *
51      * @return collection child nodes builders
52      */
53     List<DataSchemaNodeBuilder> getChildNodeBuilders();
54
55     /**
56      * Retrieves child node builder by local name.
57      *
58      * @param name
59      *            name of child to seek
60      * @return child node with given name if present, null otherwise
61      */
62     DataSchemaNodeBuilder getDataChildByName(String name);
63
64     /**
65      * Add builder of child node to this node.
66      *
67      * @param childNode name of child node to add
68      */
69     void addChildNode(DataSchemaNodeBuilder childNode);
70
71     /**
72      * Add builder of child node to this node at specified position.
73      *
74      * @param index position at which the child node will be added
75      * @param childNode name of child node to add at specified position
76      */
77     void addChildNode(int index, DataSchemaNodeBuilder childNode);
78
79     void addChildNode(DataSchemaNode childNode);
80
81     void addChildNodeToContext(DataSchemaNodeBuilder childNode);
82
83     /**
84      * Get already built groupings defined in this node.
85      *
86      * @return collection of GroupingDefinition objects
87      */
88     Set<GroupingDefinition> getGroupings();
89
90     /**
91      * Get builders of groupings defined in this node.
92      *
93      * @return collection of grouping builders
94      */
95     Set<GroupingBuilder> getGroupingBuilders();
96
97     /**
98      * Add builder of grouping statement to this node.
99      *
100      * @param groupingBuilder grouping statement builder
101      */
102     void addGrouping(GroupingBuilder groupingBuilder);
103
104     /**
105      * Get builders of uses defined in this node.
106      *
107      * @return collection of uses builders
108      */
109     List<UsesNodeBuilder> getUsesNodeBuilders();
110
111     /**
112      * Add builder of uses statement to this node.
113      *
114      * @param usesBuilder uses statement builder
115      */
116     void addUsesNode(UsesNodeBuilder usesBuilder);
117
118     /**
119      * Returns set of already built type definitions.
120      *
121      * @return set of already built type definitions.
122      */
123     Set<TypeDefinition<?>> getTypeDefinitions();
124
125     /**
126      * Returns builders of typedef statement defined in this node.
127      *
128      * @return builders of typedef statement defined in this node.
129      */
130     Set<TypeDefinitionBuilder> getTypeDefinitionBuilders();
131
132     /**
133      * Add typedef builder to this node.
134      *
135      * @param typedefBuilder
136      *            Builder to add to this node.
137      */
138     void addTypedef(TypeDefinitionBuilder typedefBuilder);
139
140     /**
141      * Returns an instance of product - DataNodeContainer
142      *
143      * Returns an instance of data node container with children and properties
144      * constructed as per this builder state, all nested builders are also built
145      * and their product is set to DataNodeContainer.
146      *
147      * @return Instance of DataNodeContainer
148      */
149     @Override
150     DataNodeContainer build();
151
152     /**
153      * Returns map of child nodes of this node. Child nodes should be in same
154      * order as they were defined in yang file.
155      *
156      * @return map of child nodes of this node
157      */
158     Map<QName, DataSchemaNode> getChildNodes();
159
160 }