Integrate RestconfNormalizedNodeWriter
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / legacy / WriterParameters.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.legacy;
9
10 import com.google.common.annotations.Beta;
11 import java.util.List;
12 import java.util.Set;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.restconf.api.query.DepthParam;
16 import org.opendaylight.yangtools.yang.common.QName;
17
18 /**
19  * This holds various options acquired from a requests's query part. This class needs to be further split up to make
20  * sense of it, as parts of it pertain to how a {@link NormalizedNodePayload} should be created while others how it
21  * needs to be processed (for example filtered).
22  */
23 @Beta
24 public record WriterParameters(@Nullable DepthParam depth, @Nullable List<Set<QName>> fields) {
25     public static final @NonNull WriterParameters EMPTY = new WriterParameters(null, null);
26
27     public static @NonNull WriterParameters of(final @Nullable DepthParam depth) {
28         return depth == null ? EMPTY : new WriterParameters(depth, null);
29     }
30 }