e54b7d3a64fb7fb553c967934c1cd4164872ef0c
[mdsal.git] / binding / mdsal-binding-dom-codec-api / src / main / java / org / opendaylight / mdsal / binding / dom / codec / api / CommonDataObjectCodecTreeNode.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.mdsal.binding.dom.codec.api;
9
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.yangtools.yang.binding.DataObject;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15
16 /**
17  * Common interface shared between {@link BindingDataObjectCodecTreeNode} and {@link BindingAugmentationCodecTreeNode}.
18  * This interface should never be implemented on its own.
19  *
20  * @param <T> DataObject type
21  */
22 public interface CommonDataObjectCodecTreeNode<T extends DataObject> extends BindingDataContainerCodecTreeNode<T> {
23     /**
24      * Serializes path argument for current node.
25      *
26      * @param arg Binding Path Argument, may be null if Binding Instance Identifier does not have a representation for
27      *            current node (e.g. choice or case).
28      * @return Yang Path Argument, may be null if Yang Instance Identifier does not have representation for current node
29      *         (e.g. case).
30      * @throws IllegalArgumentException If supplied {@code arg} is not valid.
31      */
32     @Beta
33     YangInstanceIdentifier.@Nullable PathArgument serializePathArgument(InstanceIdentifier.@Nullable PathArgument arg);
34
35     /**
36      * Deserializes path argument for current node.
37      *
38      * @param arg Yang Path Argument, may be null if Yang Instance Identifier does not have
39      *         representation for current node (e.g. case).
40      * @return Binding Path Argument, may be null if Binding Instance Identifier does not have
41      *        representation for current node (e.g. choice or case).
42      * @throws IllegalArgumentException If supplied {@code arg} is not valid.
43      */
44     @Beta
45     InstanceIdentifier.@Nullable PathArgument deserializePathArgument(
46             YangInstanceIdentifier.@Nullable PathArgument arg);
47 }