2 * Copyright (c) 2014 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 java.util.Map.Entry;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.yangtools.yang.binding.DataContainer;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.binding.Notification;
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 extends
27 org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer {
30 * Translates supplied Binding Instance Identifier into NormalizedNode
31 * instance identifier.
34 * Binding Instance Identifier
35 * @return DOM Instance Identifier
36 * @throws IllegalArgumentException
37 * If supplied Instance Identifier is not valid.
40 YangInstanceIdentifier toYangInstanceIdentifier(@Nonnull InstanceIdentifier<?> binding);
43 * Translates supplied YANG Instance Identifier into Binding instance
47 * YANG Instance Identifier
48 * @return Binding Instance Identifier, or null if the instance identifier
49 * is not representable.
53 InstanceIdentifier<?> fromYangInstanceIdentifier(@Nonnull YangInstanceIdentifier dom);
56 * Translates supplied Binding Instance Identifier and data into
57 * NormalizedNode representation.
60 * Binding Instance Identifier pointing to data
62 * Data object representing data
63 * @return NormalizedNode representation
64 * @throws IllegalArgumentException
65 * If supplied Instance Identifier is not valid.
68 <T extends DataObject> Entry<YangInstanceIdentifier, NormalizedNode<?, ?>> toNormalizedNode(
69 InstanceIdentifier<T> path, T data);
72 * Translates supplied YANG Instance Identifier and NormalizedNode into
75 * @param path Binding Instance Identifier
76 * @param data NormalizedNode representing data
77 * @return DOM Instance Identifier
81 Entry<InstanceIdentifier<?>, DataObject> fromNormalizedNode(@Nonnull YangInstanceIdentifier path,
82 NormalizedNode<?, ?> data);
85 * Translates supplied NormalizedNode Notification into Binding data.
87 * @param path Schema Path of Notification, schema path is absolute, and consists of Notification QName.
88 * @param data NormalizedNode representing data
89 * @return Binding representation of Notification
92 @Nullable Notification fromNormalizedNodeNotification(@Nonnull SchemaPath path,@Nonnull ContainerNode data);
95 * Translates supplied NormalizedNode RPC input or output into Binding data.
97 * @param path Schema path of RPC data, Schema path consists of rpc QName and input / output QName.
98 * @param data NormalizedNode representing data
99 * @return Binding representation of RPC data
102 @Nullable DataObject fromNormalizedNodeRpcData(@Nonnull SchemaPath path,@Nonnull ContainerNode data);
105 * Translates supplied Binding Notification or output into NormalizedNode notification.
107 * @param data NormalizedNode representing notification data
108 * @return NormalizedNode representation of notification
111 @Nonnull ContainerNode toNormalizedNodeNotification(@Nonnull Notification data);
114 * Translates supplied Binding RPC input or output into NormalizedNode data.
116 * @param data NormalizedNode representing rpc data
117 * @return NormalizedNode representation of rpc data
120 @Nonnull ContainerNode toNormalizedNodeRpcData(@Nonnull DataContainer data);