2 * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.javav2.dom.codec.api.serializer;
10 import java.util.Map.Entry;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.mdsal.binding.javav2.spec.base.InstanceIdentifier;
14 import org.opendaylight.mdsal.binding.javav2.spec.base.Instantiable;
15 import org.opendaylight.mdsal.binding.javav2.spec.base.Notification;
16 import org.opendaylight.mdsal.binding.javav2.spec.base.TreeNode;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
20 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
23 * Serialization service, which provides two-way serialization between Java
24 * Binding Data representation and NormalizedNode representation.
26 public interface BindingNormalizedNodeSerializer {
29 * Translates supplied YANG Instance Identifier into Binding instance
33 * - YANG Instance Identifier
34 * @return Binding Instance Identifier, or null if the instance identifier
35 * is not representable
38 InstanceIdentifier<? extends TreeNode> fromYangInstanceIdentifier(@Nonnull YangInstanceIdentifier dom);
41 * Translates supplied YANG Instance Identifier and NormalizedNode into
45 * - Binding Instance Identifier
47 * - NormalizedNode representing data
48 * @return DOM Instance Identifier
51 Entry<InstanceIdentifier<? extends TreeNode>, TreeNode> fromNormalizedNode(@Nonnull YangInstanceIdentifier path,
52 NormalizedNode<?, ?> data);
55 * Translates supplied Binding Instance Identifier into NormalizedNode
56 * instance identifier.
59 * - Binding Instance Identifier
60 * @return DOM Instance Identifier
61 * @throws IllegalArgumentException
62 * - if supplied Instance Identifier is not valid
65 YangInstanceIdentifier toYangInstanceIdentifier(@Nonnull InstanceIdentifier<? extends TreeNode> binding);
68 * Translates supplied Binding Instance Identifier and data into
69 * NormalizedNode representation.
72 * - Binding Instance Identifier pointing to data
74 * - representing Data Tree
75 * @param <T> data type
76 * @return NormalizedNode representation
77 * @throws IllegalArgumentException
78 * - if supplied Instance Identifier is not valid.
81 <T extends TreeNode> Entry<YangInstanceIdentifier, NormalizedNode<?, ?>>
82 toNormalizedNode(InstanceIdentifier<T> path, T data);
85 * Translates supplied NormalizedNode Notification into Binding data.
88 * - Schema Path of Notification, schema path is absolute, and
89 * consists of Notification QName
91 * - NormalizedNode representing data
92 * @return Binding representation of Notification
95 Notification<?> fromNormalizedNodeNotification(@Nonnull SchemaPath path, @Nonnull ContainerNode data);
98 * Translates supplied Binding Notification or output into NormalizedNode
102 * NormalizedNode representing notification data
103 * @return NormalizedNode representation of notification
106 ContainerNode toNormalizedNodeNotification(@Nonnull Notification<?> data);
109 * Translates supplied NormalizedNode operation (RPC, Action) input or
110 * output into Binding data.
113 * - schema path of operation data, schema path consists of
114 * rpc/action QName and input/output QName.
116 * - NormalizedNode representing data
117 * @return Binding representation of operation data
120 TreeNode fromNormalizedNodeOperationData(@Nonnull SchemaPath path, @Nonnull ContainerNode data);
123 * Translates supplied Binding operation (RPC, Action) input or output into
124 * NormalizedNode data.
127 * - NormalizedNode representing rpc/action data
128 * @return NormalizedNode representation of operation data
131 ContainerNode toNormalizedNodeRpcData(@Nonnull Instantiable<?> data);