From: Robert Varga Date: Fri, 26 May 2023 21:51:09 +0000 (+0200) Subject: Improve BindingCodecTree.getSubtreeCodec() X-Git-Tag: v11.0.10~7 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=3b0c227f98ceaaef7d5c73cbb95b9c0b87cc9a4c;p=mdsal.git Improve BindingCodecTree.getSubtreeCodec() The only implementation we have returns non-null and throws exceptions. Promote that behaviour to how the method is meant to operate. Change-Id: I836ee8adb20d23b7b9938dbdeb827aa7a5443bc2 Signed-off-by: Robert Varga (cherry picked from commit 595e8b44f8fd85c6df1b09d05c8d807c02e41cc4) --- diff --git a/binding/mdsal-binding-dom-codec-api/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingCodecTree.java b/binding/mdsal-binding-dom-codec-api/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingCodecTree.java index 124d9fd3e3..37ed59f5b1 100644 --- a/binding/mdsal-binding-dom-codec-api/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingCodecTree.java +++ b/binding/mdsal-binding-dom-codec-api/src/main/java/org/opendaylight/mdsal/binding/dom/codec/api/BindingCodecTree.java @@ -23,8 +23,16 @@ import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absol */ // TODO: Add more detailed documentation public interface BindingCodecTree extends BindingDataObjectCodecTreeParent { - - @Nullable BindingDataObjectCodecTreeNode getSubtreeCodec(InstanceIdentifier path); + /** + * Look up the codec for specified path. + * + * @param DataObject type + * @param path Binding path + * @return A {@link BindingDataObjectCodecTreeNode} + * @throws NullPointerException if {@code path} is {@code null} + * @throws IllegalArgumentException if the codec cannot be resolved + */ + @NonNull BindingDataObjectCodecTreeNode getSubtreeCodec(InstanceIdentifier path); @Nullable BindingCodecTreeNode getSubtreeCodec(YangInstanceIdentifier path);