Split out RFC8040-only constructs from yang-common
[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 public class WriterParameters {
11     static final WriterParameters EMPTY = new WriterParametersBuilder().build();
12
13     private final Integer depth;
14     private final boolean prettyPrint;
15     private final boolean tagged;
16
17     protected WriterParameters(final WriterParametersBuilder builder) {
18         depth = builder.depth;
19         prettyPrint = builder.prettyPrint;
20         tagged = builder.tagged;
21     }
22
23     public Integer getDepth() {
24         return depth;
25     }
26
27     public boolean isPrettyPrint() {
28         return prettyPrint;
29     }
30
31     public boolean isTagged() {
32         return tagged;
33     }
34
35     public static class WriterParametersBuilder {
36         private Integer depth;
37         private boolean prettyPrint;
38         private boolean tagged;
39
40         public WriterParametersBuilder() {
41
42         }
43
44         public WriterParametersBuilder setDepth(final int depth) {
45             this.depth = depth;
46             return this;
47         }
48
49         public WriterParametersBuilder setPrettyPrint(final boolean prettyPrint) {
50             this.prettyPrint = prettyPrint;
51             return this;
52         }
53
54         public WriterParameters build() {
55             return new WriterParameters(this);
56         }
57
58         public void setTagged(final boolean tagged) {
59             this.tagged = tagged;
60         }
61     }
62 }