Add representations of RFC8040 query parameters
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / FilterParameter.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.restconf.nb.rfc8040;
9
10 import static java.util.Objects.requireNonNull;
11
12 import java.net.URI;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14 import org.opendaylight.yangtools.concepts.Immutable;
15
16 /**
17  * This class represents a {@code filter} parameter as defined in
18  * <a href="https://datatracker.ietf.org/doc/html/rfc8040#section-4.8.4">RFC8040 section 4.8.4</a>.
19  */
20 @NonNullByDefault
21 public final class FilterParameter implements Immutable {
22     private static final URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:filter:1.0");
23
24     // FIXME: can we have a parsed, but not bound version of an XPath, please?
25     private final String value;
26
27     private FilterParameter(final String value) {
28         this.value = requireNonNull(value);
29     }
30
31     public static FilterParameter forUriValue(final String uriValue) {
32         return new FilterParameter(uriValue);
33     }
34
35     public static String uriName() {
36         return "filter";
37     }
38
39     public String uriValue() {
40         return value;
41     }
42
43     public static URI capabilityUri() {
44         return CAPABILITY;
45     }
46 }