2 * Copyright (c) 2024 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.server.api;
10 import static java.util.Objects.requireNonNull;
12 import java.util.Collection;
13 import java.util.Map.Entry;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.eclipse.jdt.annotation.Nullable;
16 import org.opendaylight.restconf.api.QueryParameters;
17 import org.opendaylight.restconf.api.query.PrettyPrintParam;
20 * A {@link QueryParameters} implementation which is congnizant of a default {@link PrettyPrintParam}.
23 public record QueryParams(QueryParameters delegate, PrettyPrintParam prettyPrint) implements QueryParameters {
25 requireNonNull(delegate);
26 requireNonNull(prettyPrint);
30 public boolean isEmpty() {
31 return delegate.isEmpty();
35 public Collection<? extends Entry<String, String>> asCollection() {
36 return delegate.asCollection();
40 public @Nullable String lookup(final String paramName) {
41 final var ret = delegate.lookup(paramName);
45 return PrettyPrintParam.uriName.equals(paramName) ? prettyPrint.paramValue() : null;