d52de7d86c8ad1992ea0f652dd7baceeb3bcdf39
[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
16 @Deprecated(forRemoval = true, since = "2.0.6")
17 // Non-final for mocking
18 public class NormalizedNodeContext {
19     private final InstanceIdentifierContext context;
20     private final ImmutableMap<String, Object> headers;
21     private final WriterParameters writerParameters;
22     private final NormalizedNode data;
23
24     public NormalizedNodeContext(final InstanceIdentifierContext context,
25             final NormalizedNode data, final WriterParameters writerParameters,
26             final ImmutableMap<String, Object> headers) {
27         this.context = context;
28         this.data = data;
29         this.writerParameters = writerParameters;
30         this.headers = requireNonNull(headers);
31     }
32
33     public NormalizedNodeContext(final InstanceIdentifierContext context,
34                                  final NormalizedNode data, final WriterParameters writerParameters) {
35         this(context, data, writerParameters, ImmutableMap.of());
36     }
37
38     public NormalizedNodeContext(final InstanceIdentifierContext context,
39                                  final NormalizedNode data) {
40         this(context, data, WriterParameters.EMPTY, ImmutableMap.of());
41     }
42
43     public NormalizedNodeContext(final InstanceIdentifierContext context,
44             final NormalizedNode data, final ImmutableMap<String, Object> headers) {
45         this(context, data, WriterParameters.EMPTY, headers);
46     }
47
48     public InstanceIdentifierContext getInstanceIdentifierContext() {
49         return context;
50     }
51
52     public NormalizedNode getData() {
53         return data;
54     }
55
56     public WriterParameters getWriterParameters() {
57         return writerParameters;
58     }
59
60     /**
61      * Return headers of {@code NormalizedNodeContext}.
62      *
63      * @return map of headers
64      */
65     public ImmutableMap<String, Object> getNewHeaders() {
66         return headers;
67     }
68 }