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.restconf.nb.rfc8040.ContentParameter;
15 import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
20 * A RFC8040 overlay over {@link WriterParameters}. This holds various options acquired from a requests's query part.
21 * This class needs to be further split up to make sense of it, as parts of it pertain to how a
22 * {@link NormalizedNodePayload} should be created while others how it needs to be processed (for example filtered).
24 public final class QueryParameters extends WriterParameters {
25 public static final class Builder extends WriterParametersBuilder {
26 private List<YangInstanceIdentifier> fieldPaths;
27 private List<Set<QName>> fields;
28 private WithDefaultsParameter withDefault;
29 private boolean tagged;
30 private ContentParameter content;
36 public Builder setContent(final ContentParameter content) {
37 this.content = content;
41 public Builder setFields(final List<Set<QName>> fields) {
46 public Builder setFieldPaths(final List<YangInstanceIdentifier> fieldPaths) {
47 this.fieldPaths = fieldPaths;
51 public Builder setTagged(final boolean tagged) {
56 public Builder setWithDefault(final WithDefaultsParameter withDefault) {
57 this.withDefault = withDefault;
62 public @NonNull QueryParameters build() {
63 return new QueryParameters(this);
67 private static final @NonNull QueryParameters EMPTY = new Builder().build();
69 private final List<YangInstanceIdentifier> fieldPaths;
70 private final List<Set<QName>> fields;
71 private final WithDefaultsParameter withDefault;
72 private final ContentParameter content;
73 private final boolean tagged;
75 private QueryParameters(final Builder builder) {
77 content = builder.content;
78 fields = builder.fields;
79 fieldPaths = builder.fieldPaths;
80 tagged = builder.tagged;
81 withDefault = builder.withDefault;
84 public static @NonNull QueryParameters empty() {
88 public static @NonNull Builder builder() {
92 public ContentParameter getContent() {
96 public List<Set<QName>> getFields() {
100 public List<YangInstanceIdentifier> getFieldPaths() {
104 public WithDefaultsParameter getWithDefault() {
108 public boolean isTagged() {