Separate out ReadDataParams
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / FieldsParameter.java
index 3ef1531154993694aceaf9b0700ccdef686f9ea5..ab6623f3f575f8d666df8542a9ab942bf58e480d 100644 (file)
@@ -76,10 +76,12 @@ public final class FieldsParameter implements Immutable {
     private static final URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:fields:1.0");
 
     private final ImmutableList<NodeSelector> nodeSelectors;
+    private final String uriValue;
 
-    FieldsParameter(final ImmutableList<NodeSelector> nodeSelectors) {
+    private FieldsParameter(final ImmutableList<NodeSelector> nodeSelectors, final String uriValue) {
         this.nodeSelectors = requireNonNull(nodeSelectors);
         checkArgument(!nodeSelectors.isEmpty(), "At least one selector is required");
+        this.uriValue = requireNonNull(uriValue);
     }
 
     /**
@@ -90,7 +92,7 @@ public final class FieldsParameter implements Immutable {
      * @throws ParseException if {@code str} does not represent a valid {@code fields} parameter.
      */
     public static FieldsParameter parse(final String str) throws ParseException {
-        return new FieldsParameterParser().parse(str);
+        return new FieldsParameter(new FieldsParameterParser().parseNodeSelectors(str), str);
     }
 
     public static String uriName() {
@@ -110,6 +112,11 @@ public final class FieldsParameter implements Immutable {
         return nodeSelectors;
     }
 
+    // FIXME: for migration only
+    public String uriValue() {
+        return uriValue;
+    }
+
     @Override
     public String toString() {
         return MoreObjects.toStringHelper(this).add("nodeSelectors", nodeSelectors).toString();