07978083dd5e1ed001e15f7ba1143d67244df3c0
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / netconf / sal / restconf / impl / 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
9 package org.opendaylight.netconf.sal.restconf.impl;
10
11 import com.google.common.base.Optional;
12
13 public class WriterParameters {
14     private final String content;
15     private final Optional<Integer> depth;
16     private final boolean prettyPrint;
17
18     private WriterParameters(final WriterParametersBuilder builder) {
19         this.content = builder.content;
20         this.depth = builder.depth;
21         this.prettyPrint = builder.prettyPrint;
22     }
23
24     public String getContent() {
25         return content;
26     }
27
28     public Optional<Integer> getDepth() {
29         return depth;
30     }
31
32     public boolean isPrettyPrint() {
33         return prettyPrint;
34     }
35
36     public static class WriterParametersBuilder {
37         private String content;
38         private Optional<Integer> depth = Optional.absent();
39         private boolean prettyPrint;
40
41         public WriterParametersBuilder() {}
42
43         public WriterParametersBuilder setContent(final String content) {
44             this.content = content;
45             return this;
46         }
47
48         public WriterParametersBuilder setDepth(final int depth) {
49             this.depth = Optional.of(depth);
50             return this;
51         }
52
53         public WriterParametersBuilder setPrettyPrint(final boolean prettyPrint) {
54             this.prettyPrint = prettyPrint;
55             return this;
56         }
57
58         public WriterParameters build() {
59             return new WriterParameters(this);
60         }
61     }
62 }