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;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.yangtools.concepts.Immutable;
18 * This class represents a {@code depth} parameter as defined in
19 * <a href="https://datatracker.ietf.org/doc/html/rfc8040#section-4.8.3">RFC8040 section 4.8.2</a>.
21 public final class DepthParameter implements Immutable {
22 private static final @NonNull URI CAPABILITY = URI.create("urn:ietf:params:restconf:capability:depth:1.0");
24 private final int value;
26 private DepthParameter(final int value) {
28 checkArgument(value >= 1 && value <= 65535);
31 public static DepthParameter of(final int value) {
32 return new DepthParameter(value);
35 public static @Nullable DepthParameter forUriValue(final String uriValue) {
36 return uriValue.equals("unbounded") ? null : of(Integer.parseUnsignedInt(uriValue, 10));
43 public static @NonNull String uriName() {
47 public @NonNull String uriValue() {
48 return String.valueOf(value);
51 public static @NonNull URI capabilityUri() {