2 * Copyright © 2020 FRINX s.r.o. All rights reserved.
3 * Copyright © 2021 PANTHEON.tech, s.r.o.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netconf.sal.connect.netconf.util;
11 import static java.util.Objects.requireNonNull;
13 import com.google.common.annotations.Beta;
14 import com.google.common.collect.ImmutableList;
15 import java.util.List;
16 import org.eclipse.jdt.annotation.NonNull;
17 import org.opendaylight.yangtools.concepts.Immutable;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
21 * Definition of the subtree filter with single parent path and possibly multiple field sub-paths that are used
22 * for reading/selection of specific entities.
25 public final class FieldsFilter implements Immutable {
26 private final @NonNull YangInstanceIdentifier path;
27 private final @NonNull List<YangInstanceIdentifier> fields;
29 private FieldsFilter(final YangInstanceIdentifier path, final List<YangInstanceIdentifier> fields) {
30 this.path = requireNonNull(path);
31 this.fields = ImmutableList.copyOf(fields);
35 * Create a {@link FieldsFilter} using parent path and fields. Field paths are relative to parent path.
37 * @param path parent query path
38 * @param fields list of specific selection fields
39 * @return instance of {@link FieldsFilter}
40 * @throws NullPointerException if any argument is null, or if {@code fields} contains a null element
42 public static @NonNull FieldsFilter of(final YangInstanceIdentifier path,
43 final List<YangInstanceIdentifier> fields) {
44 return new FieldsFilter(path, fields);
50 * @return instance of {@link YangInstanceIdentifier}
52 public @NonNull YangInstanceIdentifier path() {
57 * Get list of paths that narrows the filter for specific fields. Field paths are relative to parent path.
59 * @return {@link List} of field paths.
61 public @NonNull List<YangInstanceIdentifier> fields() {