Added tests for yang.model.util
[yangtools.git] / code-generator / binding-data-codec / src / main / java / org / opendaylight / yangtools / binding / data / codec / api / BindingNormalizedNodeSerializer.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. 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.yangtools.binding.data.codec.api;
9
10 import java.util.Map;
11 import java.util.Map.Entry;
12
13 import org.opendaylight.yangtools.yang.binding.DataObject;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
16 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
17
18 /**
19  * Serialization service, which provides two-way serialization between
20  * Java Binding Data representation and NormalizedNode representation.
21  *
22  */
23 public interface BindingNormalizedNodeSerializer {
24
25      /**
26       * Translates supplied Binding Instance Identifier into NormalizedNode instance identifier.
27       *
28       * @param binding Binding Instance Identifier
29       * @return DOM Instance Identifier
30       */
31      YangInstanceIdentifier toYangInstanceIdentifier(InstanceIdentifier<?> binding);
32
33      /**
34       * Translates supplied YANG Instance Identifier into Binding instance identifier.
35       *
36       * @param dom YANG Instance Identifier
37       * @return Binding Instance Identifier
38       */
39      InstanceIdentifier<?> fromYangInstanceIdentifier(YangInstanceIdentifier dom);
40
41      /**
42       * Translates supplied Binding Instance Identifier and data into NormalizedNode representation.
43       *
44       * @param path Binding Instance Identifier pointing to data
45       * @param data Data object representing data
46       * @return NormalizedNode representation
47       */
48      <T extends DataObject> Entry<YangInstanceIdentifier,NormalizedNode<?,?>> toNormalizedNode(InstanceIdentifier<T> path, T data);
49
50      /**
51       * Translates supplied YANG Instance Identifier and NormalizedNode into Binding data.
52       *
53       * @param path Binding Instance Identifier
54       * @param data NormalizedNode representing data
55       * @return DOM Instance Identifier
56       */
57      Entry<InstanceIdentifier<?>,DataObject> fromNormalizedNode(YangInstanceIdentifier path, NormalizedNode<?, ?> data);
58
59      /**
60       * Returns map view which contains translated set of entries to normalized nodes.
61       * Returned set will not contain representation of leaf nodes.
62       *
63       * @param dom Map of YANG Instance Identifier to Data
64       * @return Map of Binding Instance Identifier to data.
65       */
66      Map<InstanceIdentifier<?>,DataObject> fromNormalizedNodes(Map<YangInstanceIdentifier,NormalizedNode<?,?>> dom);
67
68 }