2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.yangtools.yang.model.api;
10 import java.util.Collection;
11 import java.util.Optional;
13 import javax.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.common.QName;
17 * Node which can contains other nodes.
19 public interface DataNodeContainer {
22 * Returns set of all newly defined types within this DataNodeContainer.
24 * @return typedef statements in lexicographical order
26 Set<TypeDefinition<?>> getTypeDefinitions();
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.
33 * @return child nodes in lexicographical order
35 Collection<DataSchemaNode> getChildNodes();
38 * Returns set of all groupings defined within this DataNodeContainer.
40 * @return grouping statements in lexicographical order
42 Set<GroupingDefinition> getGroupings();
45 * Returns the child node corresponding to the specified name.
49 * @return child node of this DataNodeContainer if child with given name is present, null otherwise
51 * @deprecated Use {@link #findDataChildByName(QName)} instead.
54 @Nullable default DataSchemaNode getDataChildByName(final QName name) {
55 return findDataChildByName(name).orElse(null);
59 * Returns the child node corresponding to the specified name.
63 * @return child node of this DataNodeContainer if child with given name is present, empty otherwise
64 * @throws NullPointerException if name is null
66 Optional<DataSchemaNode> findDataChildByName(QName name);
69 * Returns grouping nodes used ny this container.
71 * @return Set of all uses nodes defined within this DataNodeContainer
73 Set<UsesNode> getUses();