Use yang-data-codec-binfmt
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / datastore / node / utils / stream / NormalizedNodeDataOutput.java
1 /*
2  * Copyright (c) 2014, 2015 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.controller.cluster.datastore.node.utils.stream;
9
10 import com.google.common.annotations.Beta;
11 import java.io.DataOutput;
12 import java.io.IOException;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
18 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
19 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
20
21 /**
22  * Interface for emitting {@link NormalizedNode}s, {@link YangInstanceIdentifier}s, {@link PathArgument}s
23  * and {@link SchemaPath}s.
24  *
25  * @deprecated Used {@link org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeDataOutput} instead.
26  */
27 @Deprecated(forRemoval = true)
28 @Beta
29 public interface NormalizedNodeDataOutput extends AutoCloseable, DataOutput {
30     void writeQName(@NonNull QName qname) throws IOException;
31
32     void writeNormalizedNode(@NonNull NormalizedNode<?, ?> normalizedNode) throws IOException;
33
34     void writePathArgument(PathArgument pathArgument) throws IOException;
35
36     void writeYangInstanceIdentifier(YangInstanceIdentifier identifier) throws IOException;
37
38     void writeSchemaPath(SchemaPath path) throws IOException;
39
40     @Override
41     void close() throws IOException;
42
43     default void writeOptionalNormalizedNode(final @Nullable NormalizedNode<?, ?> normalizedNode) throws IOException {
44         if (normalizedNode != null) {
45             writeBoolean(true);
46             writeNormalizedNode(normalizedNode);
47         } else {
48             writeBoolean(false);
49         }
50     }
51 }