2 * Copyright (c) 2023 Orange 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.api.query;
11 import org.eclipse.jdt.annotation.NonNull;
14 * OpenDaylight extension parameter. When used as {@code odl-child-nodes-only=true}, it will instruct the listener
15 * streams to only emit child nodes.
17 public final class ChildNodesOnlyParam implements RestconfQueryParam<ChildNodesOnlyParam> {
18 // API consistency: must not be confused with enum constants
19 @SuppressWarnings("checkstyle:ConstantName")
20 public static final String uriName = "odl-child-nodes-only";
22 private static final @NonNull URI CAPABILITY =
23 URI.create("urn:opendaylight:params:restconf:capability:child-nodes-only:1.0");
24 private static final @NonNull ChildNodesOnlyParam FALSE = new ChildNodesOnlyParam(false);
25 private static final @NonNull ChildNodesOnlyParam TRUE = new ChildNodesOnlyParam(true);
27 private final boolean value;
29 private ChildNodesOnlyParam(final boolean value) {
33 public static @NonNull ChildNodesOnlyParam of(final boolean value) {
34 return value ? TRUE : FALSE;
37 public static @NonNull ChildNodesOnlyParam forUriValue(final String uriValue) {
38 return switch (uriValue) {
39 case "false" -> FALSE;
41 default -> throw new IllegalArgumentException("Value can be 'false' or 'true', not '" + uriValue + "'");
46 public Class<ChildNodesOnlyParam> javaClass() {
47 return ChildNodesOnlyParam.class;
51 public String paramName() {
56 public String paramValue() {
57 return String.valueOf(value);
60 public boolean value() {
64 public static @NonNull URI capabilityUri() {