Merge "Fixed incorrect test location."
[mdsal.git] / code-generator / binding-data-codec / src / main / java / org / opendaylight / yangtools / binding / data / codec / api / BindingNormalizedNodeWriterFactory.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.Entry;
11 import org.opendaylight.yangtools.yang.binding.BindingStreamEventWriter;
12 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
15
16 /**
17  *
18  * Factory for {@link BindingStreamEventWriter}, which provides stream writers
19  * which translates data and delegates calls to
20  * {@link NormalizedNodeStreamWriter}.
21  *
22  */
23 public interface BindingNormalizedNodeWriterFactory {
24
25     /**
26      *
27      * Creates a {@link BindingStreamEventWriter} for data tree path which will
28      * translate to NormalizedNode model and invoke proper events on supplied
29      * {@link NormalizedNodeStreamWriter}.
30      * <p>
31      * Also provides translation of supplied Instance Identifier to
32      * {@link YangInstanceIdentifier} so client code, does not need to translate
33      * that separately.
34      * <p>
35      * If {@link YangInstanceIdentifier} is not needed, please use
36      * {@link #newWriter(InstanceIdentifier, NormalizedNodeStreamWriter)}
37      * method to conserve resources.
38      *
39      * @param path
40      *            Binding Path in conceptual data tree, for which writer should
41      *            be instantiated
42      * @param domWriter
43      *            Stream writer on which events will be invoked.
44      * @return Instance Identifier and {@link BindingStreamEventWriter}
45      *         which will write to supplied {@link NormalizedNodeStreamWriter}.
46      */
47     public Entry<YangInstanceIdentifier, BindingStreamEventWriter> newWriterAndIdentifier(final InstanceIdentifier<?> path,
48             final NormalizedNodeStreamWriter domWriter);
49
50     /**
51      *
52      * Creates a {@link BindingStreamEventWriter} for data tree path which will
53      * translate to NormalizedNode model and invoke proper events on supplied
54      * {@link NormalizedNodeStreamWriter}.
55      * <p>
56      *
57      * This variation does not provide YANG instance identifier and is useful
58      * for use-cases, where {@link InstanceIdentifier} translation is done
59      * in other way, or YANG instance identifier is unnecessary (e.g. notifications, RPCs).
60      *
61      * @param path Binding Path in conceptual data tree, for which writer should
62      *            be instantiated
63      * @param domWriter Stream writer on which events will be invoked.
64      * @return {@link BindingStreamEventWriter}
65      *         which will write to supplied {@link NormalizedNodeStreamWriter}.
66      */
67     public BindingStreamEventWriter newWriter(final InstanceIdentifier<?> path,
68             final NormalizedNodeStreamWriter domWriter);
69
70 }