Add RestconfQueryParam
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / FilterParam.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.NonNull;
14
15 /**
16  * This class represents a {@code filter} parameter as defined in
17  * <a href="https://datatracker.ietf.org/doc/html/rfc8040#section-4.8.4">RFC8040 section 4.8.4</a>.
18  */
19
20 public final class FilterParam implements RestconfQueryParam<FilterParam> {
21     private static final @NonNull URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:filter:1.0");
22
23     // FIXME: can we have a parsed, but not bound version of an XPath, please?
24     private final @NonNull String value;
25
26     private FilterParam(final String value) {
27         this.value = requireNonNull(value);
28     }
29
30     @Override
31     public Class<@NonNull FilterParam> javaClass() {
32         return FilterParam.class;
33     }
34
35     @Override
36     public String paramName() {
37         return uriName();
38     }
39
40     @Override
41     public String paramValue() {
42         return value;
43     }
44
45     public static @NonNull FilterParam forUriValue(final String uriValue) {
46         return new FilterParam(uriValue);
47     }
48
49     public static @NonNull String uriName() {
50         return "filter";
51     }
52
53     public static @NonNull URI capabilityUri() {
54         return CAPABILITY;
55     }
56 }