2 * Copyright (c) 2014 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.data.api.schema;
10 import java.util.Collection;
11 import java.util.Optional;
12 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
15 * Node which is not leaf, but has child {@link NormalizedNode}s as its value.
18 * NormalizedNodeContainer does not have a value, but it has a child nodes. Definition of possible and valid child nodes
19 * is introduced in subclasses of this interface.
22 * This interface should not be used directly, but rather use of of derived subclasses such as
23 * {@link DataContainerNode}, {@link MapNode}, {@link LeafSetNode}.
25 * @param <I> Node Identifier type
26 * @param <K> Child Node Identifier type
27 * @param <V> Child Node type
29 public interface NormalizedNodeContainer<I extends PathArgument, K extends PathArgument,
30 V extends NormalizedNode<? extends K, ?>> extends NormalizedNode<I, Collection<V>> {
36 * Returns immutable iteration of child nodes of this node.
39 Collection<V> getValue();
42 * Return the logical size of this container, i.e. the number of children in contains.
45 * Default implementation defers to the collection returned by {@link #getValue()}. Implementations are strongly
46 * encouraged to provide a more efficient implementation of this method.
48 * @return Number of child nodes in this container.
50 // FIXME: 7.0.0: consider making this method non-default, but then it will conflict in OrderedLeafSet
52 return getValue().size();
56 * Returns child node identified by provided key.
58 * @param child Path argument identifying child node
59 * @return Optional with child node if child exists. {@link Optional#empty()} if child does not exist.
61 Optional<V> getChild(K child);