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;
16 import org.opendaylight.yangtools.concepts.Immutable;
19 * This class represents a {@code depth} parameter as defined in
20 * <a href="https://datatracker.ietf.org/doc/html/rfc8040#section-4.8.3">RFC8040 section 4.8.2</a>.
22 public final class DepthParameter implements Immutable {
23 private static final @NonNull URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:depth:1.0");
24 private static final @NonNull DepthParameter MIN = of(1);
25 private static final @NonNull DepthParameter MAX = of(65535);
27 private final int value;
29 private DepthParameter(final int value) {
31 checkArgument(value >= 1 && value <= 65535);
34 public static @NonNull DepthParameter of(final int value) {
35 return new DepthParameter(value);
39 public static @NonNull DepthParameter min() {
44 public static @NonNull DepthParameter max() {
48 public static @Nullable DepthParameter forUriValue(final String uriValue) {
49 return uriValue.equals(unboundedUriValue()) ? null : of(Integer.parseUnsignedInt(uriValue, 10));
56 public static @NonNull String uriName() {
60 public @NonNull String uriValue() {
61 return String.valueOf(value);
64 public static String unboundedUriValue() {
68 public static @NonNull URI capabilityUri() {