Drop @Beta from BindingCodecTree methods
[yangtools.git] / binding / mdsal-binding-dom-codec-api / src / main / java / org / opendaylight / mdsal / binding / dom / codec / api / BindingCodecTree.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. 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.mdsal.binding.dom.codec.api;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.yangtools.yang.binding.Augmentation;
15 import org.opendaylight.yangtools.yang.binding.DataObject;
16 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
17 import org.opendaylight.yangtools.yang.common.Empty;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
20
21 /**
22  * Navigable tree representing hierarchy of Binding to Normalized Node codecs. This navigable tree is associated to
23  * a concrete set of YANG models, represented by SchemaContext and provides access to subtree specific serialization
24  * context.
25  */
26 // TODO: Add more detailed documentation
27 public interface BindingCodecTree extends BindingDataObjectCodecTreeParent<Empty> {
28     /**
29      * A DTO holding a {@link CommonDataObjectCodecTreeNode} and the corresponding {@link YangInstanceIdentifier}.
30      *
31      * @param <T> {@link DataObject} type
32      */
33     record CodecWithPath<T extends DataObject>(
34             @NonNull CommonDataObjectCodecTreeNode<T> codec,
35             @NonNull YangInstanceIdentifier path) {
36         public CodecWithPath {
37             requireNonNull(codec);
38             requireNonNull(path);
39         }
40     }
41
42     /**
43      * Look up the codec for specified augmentation path.
44      *
45      * @param <A> DataObject type
46      * @param path Binding path
47      * @return A {@link BindingAugmentationCodecTreeNode}
48      * @throws NullPointerException if {@code path} is {@code null}
49      * @throws IllegalArgumentException if the codec cannot be resolved
50      */
51     <A extends Augmentation<?>> @NonNull BindingAugmentationCodecTreeNode<A> getAugmentationCodec(
52         InstanceIdentifier<A> path);
53
54     /**
55      * Look up the codec for specified ordinary DataObject path.
56      *
57      * @param <T> DataObject type
58      * @param path Binding path
59      * @return A {@link BindingDataObjectCodecTreeNode}
60      * @throws NullPointerException if {@code path} is {@code null}
61      * @throws IllegalArgumentException if the codec cannot be resolved or refers to an Augmentation
62      */
63     <T extends DataObject> @NonNull BindingDataObjectCodecTreeNode<T> getDataObjectCodec(InstanceIdentifier<T> path);
64
65     /**
66      * Look up the codec for specified path, constructing the {@link YangInstanceIdentifier} corresponding to it.
67      *
68      * @param <T> DataObject type
69      * @param path Binding path
70      * @return A {@link CodecWithPath}
71      * @throws NullPointerException if {@code path} is {@code null}
72      * @throws IllegalArgumentException if the codec cannot be resolved
73      */
74     <T extends DataObject> @NonNull CodecWithPath<T> getSubtreeCodecWithPath(InstanceIdentifier<T> path);
75
76     /**
77      * Look up the codec for specified path.
78      *
79      * @param <T> DataObject type
80      * @param path Binding path
81      * @return A {@link BindingDataObjectCodecTreeNode}
82      * @throws NullPointerException if {@code path} is {@code null}
83      * @throws IllegalArgumentException if the codec cannot be resolved
84      */
85     <T extends DataObject> @NonNull CommonDataObjectCodecTreeNode<T> getSubtreeCodec(InstanceIdentifier<T> path);
86
87     // FIXME: NonNull and throwing exception
88     @Nullable BindingCodecTreeNode getSubtreeCodec(YangInstanceIdentifier path);
89
90     // FIXME: NonNull and throwing exception
91     @Nullable BindingCodecTreeNode getSubtreeCodec(Absolute path);
92
93     /**
94      * Get the {@link BindingIdentityCodec} associated with this tree.
95      *
96      * @return A BindingIdentityCodec instance.
97      */
98     @NonNull BindingIdentityCodec getIdentityCodec();
99
100     /**
101      * Get the {@link BindingInstanceIdentifierCodec} associated with this tree.
102      *
103      * @return A BindingInstanceIdentifierCodec instance.
104      */
105     @NonNull BindingInstanceIdentifierCodec getInstanceIdentifierCodec();
106 }