Convert ReadDataParams to Java record
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / ReadDataParams.java
1 /*
2  * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.restconf.nb.rfc8040;
9
10 import static java.util.Objects.requireNonNull;
11
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.eclipse.jdt.annotation.Nullable;
14 import org.opendaylight.restconf.api.query.ContentParam;
15 import org.opendaylight.restconf.api.query.DepthParam;
16 import org.opendaylight.restconf.api.query.FieldsParam;
17 import org.opendaylight.restconf.api.query.PrettyPrintParam;
18 import org.opendaylight.restconf.api.query.WithDefaultsParam;
19 import org.opendaylight.yangtools.concepts.Immutable;
20
21 /**
22  * Parser and holder of query parameters from uriInfo for data and datastore read operations.
23  */
24 public record ReadDataParams(
25         @NonNull ContentParam content,
26         @Nullable DepthParam depth,
27         @Nullable FieldsParam fields,
28         @Nullable WithDefaultsParam withDefaults,
29         @Nullable PrettyPrintParam prettyPrint) implements Immutable {
30     private static final @NonNull ReadDataParams EMPTY =
31         new ReadDataParams(ContentParam.ALL, null, null, null, null);
32
33     public ReadDataParams {
34         requireNonNull(content);
35     }
36
37     public static @NonNull ReadDataParams empty() {
38         return EMPTY;
39     }
40 }