2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.restconf.common.context;
10 import java.util.List;
12 import org.opendaylight.yangtools.yang.common.QName;
13 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 public final class WriterParameters {
16 static final WriterParameters EMPTY = new WriterParametersBuilder().build();
18 private final String content;
19 private final Integer depth;
20 private final List<Set<QName>> fields;
21 private final List<YangInstanceIdentifier> fieldPaths;
22 private final boolean prettyPrint;
23 private final boolean tagged;
24 private final String withDefault;
26 private WriterParameters(final WriterParametersBuilder builder) {
27 content = builder.content;
28 depth = builder.depth;
29 fields = builder.fields;
30 fieldPaths = builder.fieldPaths;
31 prettyPrint = builder.prettyPrint;
32 tagged = builder.tagged;
33 withDefault = builder.withDefault;
36 public String getContent() {
40 public Integer getDepth() {
44 public List<Set<QName>> getFields() {
48 public List<YangInstanceIdentifier> getFieldPaths() {
52 public boolean isPrettyPrint() {
56 public boolean isTagged() {
60 public String getWithDefault() {
64 public static class WriterParametersBuilder {
65 private String content;
66 private Integer depth;
67 private List<Set<QName>> fields;
68 private List<YangInstanceIdentifier> fieldPaths;
69 private boolean prettyPrint;
70 private boolean tagged;
71 private String withDefault;
73 public WriterParametersBuilder() {
77 public WriterParametersBuilder setContent(final String content) {
78 this.content = content;
82 public WriterParametersBuilder setDepth(final int depth) {
87 public WriterParametersBuilder setFields(final List<Set<QName>> fields) {
92 public WriterParametersBuilder setFieldPaths(final List<YangInstanceIdentifier> fieldPaths) {
93 this.fieldPaths = fieldPaths;
97 public WriterParametersBuilder setPrettyPrint(final boolean prettyPrint) {
98 this.prettyPrint = prettyPrint;
102 public WriterParametersBuilder setWithDefault(final String withDefault) {
103 this.withDefault = withDefault;
107 public WriterParameters build() {
108 return new WriterParameters(this);
111 public void setTagged(final boolean tagged) {
112 this.tagged = tagged;