Add RFC7952 data model extensions
[yangtools.git] / yang / rfc7952-data-api / src / main / java / org / opendaylight / yangtools / rfc7952 / data / api / NormalizedMetadata.java
1 /*
2  * Copyright (c) 2019 PANTHEON.tech, s.r.o. 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.rfc7952.data.api;
9
10 import com.google.common.annotations.Beta;
11 import java.util.Map;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.concepts.Identifiable;
14 import org.opendaylight.yangtools.concepts.Immutable;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
17 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
18 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20 import org.opendaylight.yangtools.yang.data.api.schema.UnkeyedListNode;
21
22 /**
23  * RFC7952 metadata counterpart to a {@link NormalizedNode}. This interface is meant to be used as a companion to
24  * a NormalizedNode instance, hence it does not support iterating over its structure like it is possible with
25  * {@link NormalizedNode#getValue()}.
26  *
27  * <p>
28  * This model of metadata <em>does not</em> have the RFC7952 restriction on metadata attachment to {@code list}s and
29  * {@code leaf-list}s because NormalizedNode data model has {@link LeafSetNode}, {@link MapNode} and
30  * {@link UnkeyedListNode} to which metadata can be attached.
31  *
32  * @author Robert Varga
33  */
34 @Beta
35 public interface NormalizedMetadata extends Identifiable<PathArgument>, Immutable {
36     /**
37      * Return the set of annotations defined in this metadata node. Values are expected to be effectively-immutable
38      * scalar types, like {@link String}s, {@link Number}s and similar.
39      *
40      * @return The set of annotations attached to the corresponding data node.
41      */
42     @NonNull Map<QName, Object> getAnnotations();
43 }