308697a7cffd28aadf4f7070a94348d0db6e8e23
[yangtools.git] / yang / yang-model-api / src / main / java / org / opendaylight / yangtools / yang / model / api / DataNodeContainer.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.model.api;
9
10 import java.util.Collection;
11 import java.util.Optional;
12 import java.util.Set;
13 import javax.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.common.QName;
15
16 /**
17  * Node which can contains other nodes.
18  */
19 public interface DataNodeContainer {
20
21     /**
22      * Returns set of all newly defined types within this DataNodeContainer.
23      *
24      * @return typedef statements in lexicographical order
25      */
26     Set<TypeDefinition<?>> getTypeDefinitions();
27
28     /**
29      * Returns set of all child nodes defined within this DataNodeContainer.
30      * Although the return type is a collection, each node is guaranteed to
31      * be present at most once.
32      *
33      * @return child nodes in lexicographical order
34      */
35     Collection<DataSchemaNode> getChildNodes();
36
37     /**
38      * Returns set of all groupings defined within this DataNodeContainer.
39      *
40      * @return grouping statements in lexicographical order
41      */
42     Set<GroupingDefinition> getGroupings();
43
44     /**
45      * Returns the child node corresponding to the specified name.
46      *
47      * @param name
48      *            QName of child
49      * @return child node of this DataNodeContainer if child with given name is present, null otherwise
50      *
51      * @deprecated Use {@link #findDataChildByName(QName)} instead.
52      */
53     @Deprecated
54     @Nullable default DataSchemaNode getDataChildByName(final QName name) {
55         return findDataChildByName(name).orElse(null);
56     }
57
58     /**
59      * Returns the child node corresponding to the specified name.
60      *
61      * @param name
62      *            QName of child
63      * @return child node of this DataNodeContainer if child with given name is present, empty otherwise
64      * @throws NullPointerException if name is null
65      */
66     Optional<DataSchemaNode> findDataChildByName(QName name);
67
68     /**
69      * Returns grouping nodes used ny this container.
70      *
71      * @return Set of all uses nodes defined within this DataNodeContainer
72      */
73     Set<UsesNode> getUses();
74 }