Split out NormalizedContainer
[yangtools.git] / data / yang-data-api / src / main / java / org / opendaylight / yangtools / yang / data / api / schema / NormalizedData.java
1 /*
2  * Copyright (c) 2023 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.yang.data.api.schema;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.yangtools.concepts.Identifier;
12 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
13
14 /**
15  * A piece of data normalized to a particular {@link EffectiveModelContext}. We are making a distinction between
16  * {@code data} and {@code metadata} attached to it. This interface captures the former, with two specializations:
17  * {@link NormalizedNode} and {@link NormalizedYangData}.
18  */
19 public interface NormalizedData {
20     /**
21      * Return the contract governing this {@link NormalizedData} instance.
22      *
23      * @apiNote
24      *     This method should be specialized in intermediate contracts like {@link MapNode} and implemented as a default
25      *     method by interfaces which form the contracts themselves, for example {@link ContainerNode}, {@link LeafNode}
26      *     and similar.
27      *
28      * @return A class identifying the NormalizedData contract.
29      */
30     @NonNull Class<? extends NormalizedData> contract();
31
32     /**
33      * Return the name of this data.
34      *
35      * @return Name of this data.
36      */
37     @NonNull Identifier name();
38
39     /**
40      * Returns the body of this node. While the return value specifies {@link Object}, this method's return value has
41      * further semantics. The returned object must be a well-published contract, such as {@code String},
42      * {@code Collection<NormalizedNode>} or {@code DOMSource}.
43      *
44      * @return Returned value of this node.
45      */
46     @NonNull Object body();
47 }