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.yangtools.binding.data.codec.api;
11 import java.util.Map.Entry;
13 import javax.annotation.Nonnull;
14 import javax.annotation.Nullable;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
22 * Serialization service, which provides two-way serialization between
23 * Java Binding Data representation and NormalizedNode representation.
25 public interface BindingNormalizedNodeSerializer {
28 * Translates supplied Binding Instance Identifier into NormalizedNode instance identifier.
30 * @param binding Binding Instance Identifier
31 * @return DOM Instance Identifier
33 YangInstanceIdentifier toYangInstanceIdentifier(@Nonnull InstanceIdentifier<?> binding);
36 * Translates supplied YANG Instance Identifier into Binding instance identifier.
38 * @param dom YANG Instance Identifier
39 * @return Binding Instance Identifier, or null if the instance identifier is not
42 @Nullable InstanceIdentifier<?> fromYangInstanceIdentifier(@Nonnull YangInstanceIdentifier dom);
45 * Translates supplied Binding Instance Identifier and data into NormalizedNode representation.
47 * @param path Binding Instance Identifier pointing to data
48 * @param data Data object representing data
49 * @return NormalizedNode representation
51 <T extends DataObject> Entry<YangInstanceIdentifier, NormalizedNode<?,?>> toNormalizedNode(InstanceIdentifier<T> path, T data);
54 * Translates supplied YANG Instance Identifier and NormalizedNode into Binding data.
56 * @param path Binding Instance Identifier
57 * @param data NormalizedNode representing data
58 * @return DOM Instance Identifier
60 @Nullable Entry<InstanceIdentifier<?>,DataObject> fromNormalizedNode(@Nonnull YangInstanceIdentifier path, NormalizedNode<?, ?> data);
63 * Returns map view which contains translated set of entries to normalized nodes.
64 * Returned set will not contain representation of leaf nodes.
66 * @param dom Map of YANG Instance Identifier to Data
67 * @return Map of Binding Instance Identifier to data.
69 Map<InstanceIdentifier<?>,DataObject> fromNormalizedNodes(Map<YangInstanceIdentifier,NormalizedNode<?,?>> dom);