37ed59f5b169f515327f57dabdf87010db011813
[mdsal.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 com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15 import org.opendaylight.yangtools.yang.common.Empty;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
18
19 /**
20  * Navigable tree representing hierarchy of Binding to Normalized Node codecs. This navigable tree is associated to
21  * a concrete set of YANG models, represented by SchemaContext and provides access to subtree specific serialization
22  * context.
23  */
24 // TODO: Add more detailed documentation
25 public interface BindingCodecTree extends BindingDataObjectCodecTreeParent<Empty> {
26     /**
27      * Look up the codec for specified path.
28      *
29      * @param <T> DataObject type
30      * @param path Binding path
31      * @return A {@link BindingDataObjectCodecTreeNode}
32      * @throws NullPointerException if {@code path} is {@code null}
33      * @throws IllegalArgumentException if the codec cannot be resolved
34      */
35     <T extends DataObject> @NonNull BindingDataObjectCodecTreeNode<T> getSubtreeCodec(InstanceIdentifier<T> path);
36
37     @Nullable BindingCodecTreeNode getSubtreeCodec(YangInstanceIdentifier path);
38
39     @Nullable BindingCodecTreeNode getSubtreeCodec(Absolute path);
40
41     /**
42      * Get the {@link BindingIdentityCodec} associated with this tree.
43      *
44      * @return A BindingIdentityCodec instance.
45      */
46     @Beta
47     @NonNull BindingIdentityCodec getIdentityCodec();
48
49     /**
50      * Get the {@link BindingInstanceIdentifierCodec} associated with this tree.
51      *
52      * @return A BindingInstanceIdentifierCodec instance.
53      */
54     @Beta
55     @NonNull BindingInstanceIdentifierCodec getInstanceIdentifierCodec();
56 }