blob: aaa1ccc79ae81467c6e38bbf18e9f433db8b1c43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.netconf.sal.rest.impl;
import java.io.IOException;
import org.opendaylight.netconf.sal.rest.api.RestconfNormalizedNodeWriter;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
/**
* This class just delegates all of the functionality to Yangtools normalized node writer.
*/
public final class RestconfDelegatingNormalizedNodeWriter implements RestconfNormalizedNodeWriter {
private final NormalizedNodeWriter delegNNWriter;
private RestconfDelegatingNormalizedNodeWriter(final NormalizedNodeStreamWriter streamWriter, final boolean
orderKeyLeaves) {
this.delegNNWriter = NormalizedNodeWriter.forStreamWriter(streamWriter, orderKeyLeaves);
}
public static RestconfDelegatingNormalizedNodeWriter forStreamWriter(final NormalizedNodeStreamWriter writer) {
return forStreamWriter(writer, true);
}
public static RestconfDelegatingNormalizedNodeWriter forStreamWriter(final NormalizedNodeStreamWriter writer,
final boolean orderKeyLeaves) {
return new RestconfDelegatingNormalizedNodeWriter(writer, orderKeyLeaves);
}
@Override
public RestconfDelegatingNormalizedNodeWriter write(final NormalizedNode node) throws IOException {
delegNNWriter.write(node);
return this;
}
@Override
public void flush() throws IOException {
delegNNWriter.flush();
}
@Override
public void close() throws IOException {
delegNNWriter.close();
}
}
|