Separate out ReadDataParams
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / PointParam.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 org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.NonNullByDefault;
14
15 /**
16  * This class represents a {@code point} 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 @NonNullByDefault
20 public final class PointParam implements RestconfQueryParam<PointParam> {
21     // FIXME: This should be ApiPath
22     private final String value;
23
24     private PointParam(final String value) {
25         this.value = requireNonNull(value);
26     }
27
28     @Override
29     public Class<@NonNull PointParam> javaClass() {
30         return PointParam.class;
31     }
32
33     @Override
34     public String paramName() {
35         return uriName();
36     }
37
38     @Override
39     public String paramValue() {
40         return value;
41     }
42
43     public static PointParam forUriValue(final String uriValue) {
44         return new PointParam(uriValue);
45     }
46
47     public static String uriName() {
48         return "point";
49     }
50
51     public String value() {
52         return value;
53     }
54 }