Disconnect QueryParameters from WriterParameters 89/98089/6
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 23 Oct 2021 19:27:14 +0000 (21:27 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 23 Oct 2021 23:13:03 +0000 (01:13 +0200)
We do not want to carry bierman02 non-structural baggage, disconnect
from that and deprecate it.

JIRA: NETCONF-773
Change-Id: Ida080cca1107badc69b19742e2aa8f577c6d4c65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/context/WriterParameters.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/legacy/QueryParameters.java

index 0453430d7ea05ba774cd05b203efba82ed98bdd3..e7631320ae099c5a7197bf549618008ef43958d1 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.restconf.common.context;
 
-public class WriterParameters {
+@Deprecated(forRemoval = true, since = "2.0.6")
+public final class WriterParameters {
     static final WriterParameters EMPTY = new WriterParametersBuilder().build();
 
     private final Integer depth;
     private final boolean prettyPrint;
 
-    protected WriterParameters(final WriterParametersBuilder builder) {
+    private WriterParameters(final WriterParametersBuilder builder) {
         depth = builder.depth;
         prettyPrint = builder.prettyPrint;
     }
@@ -26,14 +27,11 @@ public class WriterParameters {
         return prettyPrint;
     }
 
-    public static class WriterParametersBuilder {
+    @Deprecated(forRemoval = true, since = "2.0.6")
+    public static final class WriterParametersBuilder {
         private Integer depth;
         private boolean prettyPrint;
 
-        public WriterParametersBuilder() {
-
-        }
-
         public WriterParametersBuilder setDepth(final int depth) {
             this.depth = depth;
             return this;
index b084a950de908f3b8c823ba5b573a3367bef07d9..3979a20a1ec3f8a804288258c6953cd445ef401e 100644 (file)
@@ -10,24 +10,26 @@ package org.opendaylight.restconf.nb.rfc8040.legacy;
 import java.util.List;
 import java.util.Set;
 import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.restconf.common.context.WriterParameters;
 import org.opendaylight.restconf.nb.rfc8040.ContentParameter;
 import org.opendaylight.restconf.nb.rfc8040.WithDefaultsParameter;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 
 /**
- * A RFC8040 overlay over {@link WriterParameters}. This holds various options acquired from a requests's query part.
- * This class needs to be further split up to make sense of it, as parts of it pertain to how a
- * {@link NormalizedNodePayload} should be created while others how it needs to be processed (for example filtered).
+ * This holds various options acquired from a requests's query part. This class needs to be further split up to make
+ * sense of it, as parts of it pertain to how a {@link NormalizedNodePayload} should be created while others how it
+ * needs to be processed (for example filtered).
  */
-public final class QueryParameters extends WriterParameters {
-    public static final class Builder extends WriterParametersBuilder {
+public final class QueryParameters {
+    public static final class Builder {
         private List<YangInstanceIdentifier> fieldPaths;
         private List<Set<QName>> fields;
+        private ContentParameter content;
         private WithDefaultsParameter withDefault;
+        // FIXME: this should be a DepthParameter
+        private Integer depth;
+        private boolean prettyPrint;
         private boolean tagged;
-        private ContentParameter content;
 
         Builder() {
             // Hidden on purpose
@@ -38,6 +40,11 @@ public final class QueryParameters extends WriterParameters {
             return this;
         }
 
+        public Builder setDepth(final int depth) {
+            this.depth = depth;
+            return this;
+        }
+
         public Builder setFields(final List<Set<QName>> fields) {
             this.fields = fields;
             return this;
@@ -48,6 +55,12 @@ public final class QueryParameters extends WriterParameters {
             return this;
         }
 
+        // FIXME: this is not called from anywhere. Create a PrettyPrintParameter or similar to hold it
+        public Builder setPrettyPrint(final boolean prettyPrint) {
+            this.prettyPrint = prettyPrint;
+            return this;
+        }
+
         public Builder setTagged(final boolean tagged) {
             this.tagged = tagged;
             return this;
@@ -58,7 +71,6 @@ public final class QueryParameters extends WriterParameters {
             return this;
         }
 
-        @Override
         public @NonNull QueryParameters build() {
             return new QueryParameters(this);
         }
@@ -70,14 +82,17 @@ public final class QueryParameters extends WriterParameters {
     private final List<Set<QName>> fields;
     private final WithDefaultsParameter withDefault;
     private final ContentParameter content;
+    private final Integer depth;
+    private final boolean prettyPrint;
     private final boolean tagged;
 
     private QueryParameters(final Builder builder) {
-        super(builder);
         content = builder.content;
+        depth = builder.depth;
         fields = builder.fields;
         fieldPaths = builder.fieldPaths;
         tagged = builder.tagged;
+        prettyPrint = builder.prettyPrint;
         withDefault = builder.withDefault;
     }
 
@@ -93,6 +108,10 @@ public final class QueryParameters extends WriterParameters {
         return content;
     }
 
+    public Integer getDepth() {
+        return depth;
+    }
+
     public List<Set<QName>> getFields() {
         return fields;
     }
@@ -105,6 +124,10 @@ public final class QueryParameters extends WriterParameters {
         return withDefault;
     }
 
+    public boolean isPrettyPrint() {
+        return prettyPrint;
+    }
+
     public boolean isTagged() {
         return tagged;
     }