Hide NormalizedNodeContext and WriterParameters
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / netconf / sal / rest / impl / NormalizedNodeContext.java
1 /*
2  * Copyright (c) 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.netconf.sal.rest.impl;
9
10 import static java.util.Objects.requireNonNull;
11
12 import com.google.common.collect.ImmutableMap;
13 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
14 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
15 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
16
17 @Deprecated(forRemoval = true, since = "2.0.6")
18 // Non-final for mocking
19 public class NormalizedNodeContext {
20     private final InstanceIdentifierContext<? extends SchemaNode> context;
21     private final ImmutableMap<String, Object> headers;
22     private final WriterParameters writerParameters;
23     private final NormalizedNode data;
24
25     public NormalizedNodeContext(final InstanceIdentifierContext<? extends SchemaNode> context,
26             final NormalizedNode data, final WriterParameters writerParameters,
27             final ImmutableMap<String, Object> headers) {
28         this.context = context;
29         this.data = data;
30         this.writerParameters = writerParameters;
31         this.headers = requireNonNull(headers);
32     }
33
34     public NormalizedNodeContext(final InstanceIdentifierContext<? extends SchemaNode> context,
35                                  final NormalizedNode data, final WriterParameters writerParameters) {
36         this(context, data, writerParameters, ImmutableMap.of());
37     }
38
39     public NormalizedNodeContext(final InstanceIdentifierContext<? extends SchemaNode> context,
40                                  final NormalizedNode data) {
41         this(context, data, WriterParameters.EMPTY, ImmutableMap.of());
42     }
43
44     public NormalizedNodeContext(final InstanceIdentifierContext<? extends SchemaNode> context,
45             final NormalizedNode data, final ImmutableMap<String, Object> headers) {
46         this(context, data, WriterParameters.EMPTY, headers);
47     }
48
49     public InstanceIdentifierContext<? extends SchemaNode> getInstanceIdentifierContext() {
50         return context;
51     }
52
53     public NormalizedNode getData() {
54         return data;
55     }
56
57     public WriterParameters getWriterParameters() {
58         return writerParameters;
59     }
60
61     /**
62      * Return headers of {@code NormalizedNodeContext}.
63      *
64      * @return map of headers
65      */
66     public ImmutableMap<String, Object> getNewHeaders() {
67         return headers;
68     }
69 }