Integration of RESTCONF fields to NETCONF filters
[netconf.git] / restconf / restconf-common / src / main / java / org / opendaylight / restconf / common / context / WriterParameters.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.restconf.common.context;
9
10 import java.util.List;
11 import java.util.Set;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
14
15 public final class WriterParameters {
16     private final String content;
17     private final Integer depth;
18     private final List<Set<QName>> fields;
19     private final List<YangInstanceIdentifier> fieldPaths;
20     private final boolean prettyPrint;
21     private final boolean tagged;
22     private final String withDefault;
23
24     private WriterParameters(final WriterParametersBuilder builder) {
25         this.content = builder.content;
26         this.depth = builder.depth;
27         this.fields = builder.fields;
28         this.fieldPaths = builder.fieldPaths;
29         this.prettyPrint = builder.prettyPrint;
30         this.tagged = builder.tagged;
31         this.withDefault = builder.withDefault;
32     }
33
34     public String getContent() {
35         return this.content;
36     }
37
38     public Integer getDepth() {
39         return this.depth;
40     }
41
42     public List<Set<QName>> getFields() {
43         return this.fields;
44     }
45
46     public List<YangInstanceIdentifier> getFieldPaths() {
47         return this.fieldPaths;
48     }
49
50     public boolean isPrettyPrint() {
51         return this.prettyPrint;
52     }
53
54     public boolean isTagged() {
55         return this.tagged;
56     }
57
58     public String getWithDefault() {
59         return withDefault;
60     }
61
62     public static class WriterParametersBuilder {
63         private String content;
64         private Integer depth;
65         private List<Set<QName>> fields;
66         private List<YangInstanceIdentifier> fieldPaths;
67         private boolean prettyPrint;
68         private boolean tagged;
69         private String withDefault;
70
71         public WriterParametersBuilder() {
72
73         }
74
75         public WriterParametersBuilder setContent(final String content) {
76             this.content = content;
77             return this;
78         }
79
80         public WriterParametersBuilder setDepth(final int depth) {
81             this.depth = depth;
82             return this;
83         }
84
85         public WriterParametersBuilder setFields(final List<Set<QName>> fields) {
86             this.fields = fields;
87             return this;
88         }
89
90         public WriterParametersBuilder setFieldPaths(final List<YangInstanceIdentifier> fieldPaths) {
91             this.fieldPaths = fieldPaths;
92             return this;
93         }
94
95         public WriterParametersBuilder setPrettyPrint(final boolean prettyPrint) {
96             this.prettyPrint = prettyPrint;
97             return this;
98         }
99
100         public WriterParametersBuilder setWithDefault(final String withDefault) {
101             this.withDefault = withDefault;
102             return this;
103         }
104
105         public WriterParameters build() {
106             return new WriterParameters(this);
107         }
108
109         public void setTagged(final boolean tagged) {
110             this.tagged = tagged;
111         }
112     }
113 }