2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.nb.rfc8040.legacy;
10 import java.util.List;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.restconf.common.context.WriterParameters;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 * A RFC8040 overlay over {@link WriterParameters}. This holds various options acquired from a requests's query part.
19 * This class needs to be further split up to make sense of it, as parts of it pertain to how a
20 * {@link NormalizedNodePayload} should be created while others how it needs to be processed (for example filtered).
22 public final class QueryParameters extends WriterParameters {
23 public static final class Builder extends WriterParametersBuilder {
24 private List<YangInstanceIdentifier> fieldPaths;
25 private List<Set<QName>> fields;
26 private String withDefault;
27 private boolean tagged;
28 private String content;
34 public Builder setContent(final String content) {
35 this.content = content;
39 public Builder setFields(final List<Set<QName>> fields) {
44 public Builder setFieldPaths(final List<YangInstanceIdentifier> fieldPaths) {
45 this.fieldPaths = fieldPaths;
49 public Builder setTagged(final boolean tagged) {
54 public Builder setWithDefault(final String withDefault) {
55 this.withDefault = withDefault;
60 public @NonNull QueryParameters build() {
61 return new QueryParameters(this);
65 private static final @NonNull QueryParameters EMPTY = new Builder().build();
67 private final List<YangInstanceIdentifier> fieldPaths;
68 private final List<Set<QName>> fields;
69 private final String withDefault;
70 private final boolean tagged;
71 private final String content;
73 private QueryParameters(final Builder builder) {
75 content = builder.content;
76 fields = builder.fields;
77 fieldPaths = builder.fieldPaths;
78 tagged = builder.tagged;
79 withDefault = builder.withDefault;
82 public static @NonNull QueryParameters empty() {
86 public static @NonNull Builder builder() {
90 public String getContent() {
94 public List<Set<QName>> getFields() {
98 public List<YangInstanceIdentifier> getFieldPaths() {
102 public String getWithDefault() {
106 public boolean isTagged() {