2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.restconf.nb.rfc8040;
10 import static com.google.common.base.Preconditions.checkArgument;
12 import com.google.common.annotations.Beta;
14 import org.eclipse.jdt.annotation.NonNull;
15 import org.eclipse.jdt.annotation.Nullable;
18 * This class represents a {@code depth} parameter as defined in
19 * <a href="https://datatracker.ietf.org/doc/html/rfc8040#section-4.8.2">RFC8040 section 4.8.2</a>.
21 public final class DepthParam implements RestconfQueryParam<DepthParam> {
22 // API consistency: must not be confused with enum constants
23 @SuppressWarnings("checkstyle:ConstantName")
24 public static final @NonNull String uriName = "depth";
26 private static final @NonNull URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:depth:1.0");
27 private static final @NonNull DepthParam MIN = of(1);
28 private static final @NonNull DepthParam MAX = of(65535);
30 private final int value;
32 private DepthParam(final int value) {
34 checkArgument(value >= 1 && value <= 65535);
37 public static @NonNull DepthParam of(final int value) {
38 return new DepthParam(value);
42 public Class<@NonNull DepthParam> javaClass() {
43 return DepthParam.class;
47 public String paramName() {
52 public String paramValue() {
53 return String.valueOf(value);
57 public static @NonNull DepthParam min() {
62 public static @NonNull DepthParam max() {
66 public static @Nullable DepthParam forUriValue(final String uriValue) {
67 return "unbounded".equals(uriValue) ? null : of(Integer.parseUnsignedInt(uriValue, 10));
74 public static @NonNull URI capabilityUri() {