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 com.google.common.annotations.Beta;
11 import java.util.Collection;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
18 * Containment node, which contains {@link MapEntryNode} of the same type, which may be quickly retrieved using a key.
21 * This node maps to the list node in YANG schema, schema and semantics of this node, its children and key construction
22 * is defined by YANG {@code list} statement and its {@code key} and {@code ordered-by} substatements.
24 public sealed interface MapNode
25 extends DistinctNodeContainer<NodeIdentifierWithPredicates, MapEntryNode>, DataContainerChild, MixinNode
26 permits SystemMapNode, UserMapNode {
28 Class<? extends MapNode> contract();
31 NodeIdentifier getIdentifier();
34 * Return a {@link Map} view of this node. Note that the iteration order of the returned is map is not defined in
37 * @return Map view of this node.
40 @NonNull Map<NodeIdentifierWithPredicates, MapEntryNode> asMap();
43 default Collection<@NonNull MapEntryNode> body() {
44 return asMap().values();
49 return asMap().size();
53 default boolean isEmpty() {
54 return asMap().isEmpty();