2 * Copyright (c) 2015 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.mdsal.binding.dom.codec.api;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.annotations.Beta;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
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;
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
26 // TODO: Add more detailed documentation
27 public interface BindingCodecTree extends BindingDataObjectCodecTreeParent<Empty> {
29 * A DTO holding a {@link CommonDataObjectCodecTreeNode} and the corresponding {@link YangInstanceIdentifier}.
31 * @param <T> {@link DataObject} type
33 record CodecWithPath<T extends DataObject>(
34 @NonNull CommonDataObjectCodecTreeNode<T> codec,
35 @NonNull YangInstanceIdentifier path) {
36 public CodecWithPath {
37 requireNonNull(codec);
43 * Look up the codec for specified path, constructing the {@link YangInstanceIdentifier} corresponding to it.
45 * @param <T> DataObject type
46 * @param path Binding path
47 * @return A {@link CodecWithPath}
48 * @throws NullPointerException if {@code path} is {@code null}
49 * @throws IllegalArgumentException if the codec cannot be resolved
51 <T extends DataObject> @NonNull CodecWithPath<T> getSubtreeCodecWithPath(InstanceIdentifier<T> path);
54 * Look up the codec for specified path.
56 * @param <T> DataObject type
57 * @param path Binding path
58 * @return A {@link BindingDataObjectCodecTreeNode}
59 * @throws NullPointerException if {@code path} is {@code null}
60 * @throws IllegalArgumentException if the codec cannot be resolved
62 <T extends DataObject> @NonNull CommonDataObjectCodecTreeNode<T> getSubtreeCodec(InstanceIdentifier<T> path);
64 // FIXME: NonNull and throwing exception
65 @Nullable BindingCodecTreeNode getSubtreeCodec(YangInstanceIdentifier path);
67 // FIXME: NonNull and throwing exception
68 @Nullable BindingCodecTreeNode getSubtreeCodec(Absolute path);
71 * Get the {@link BindingIdentityCodec} associated with this tree.
73 * @return A BindingIdentityCodec instance.
76 @NonNull BindingIdentityCodec getIdentityCodec();
79 * Get the {@link BindingInstanceIdentifierCodec} associated with this tree.
81 * @return A BindingInstanceIdentifierCodec instance.
84 @NonNull BindingInstanceIdentifierCodec getInstanceIdentifierCodec();