2 * Copyright (c) 2020 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.mdsal.binding.api.query;
10 import com.google.common.annotations.Beta;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.binding.ChildOf;
13 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
17 * Intermediate Query builder stage, which allows the specification of the query result type to be built up via
18 * {@link #extractChild(Class)} and {@link #extractChild(Class, Class)} methods. Once completed, use either
19 * {@link #build()} to create a simple query, or {@link #matching()} to transition to specify predicates.
21 * @param <T> Query result type
24 public interface DescendantQueryBuilder<T extends DataObject> extends StructuralBuilder<QueryExpression<T>> {
26 * Add a child path component to the specification of what needs to be extracted. This method, along with its
27 * alternatives, can be used to specify which object type to select from the root path.
29 * @param <N> Container type
30 * @param childClass child container class
31 * @return This builder
32 * @throws NullPointerException if childClass is null
34 <N extends ChildOf<? super T>> @NonNull DescendantQueryBuilder<N> extractChild(Class<N> childClass);
37 * Add a child path component to the specification of what needs to be extracted. This method, along with its
38 * alternatives, can be used to specify which object type to select from the root path.
40 * @param <C> Case type
41 * @param <N> Container type
42 * @param caseClass child case class
43 * @param childClass child container class
44 * @return This builder
45 * @throws NullPointerException if any argument is null
47 <C extends ChoiceIn<? super T> & DataObject, N extends ChildOf<? super C>>
48 @NonNull DescendantQueryBuilder<N> extractChild(Class<C> caseClass, Class<N> childClass);
51 * Start specifying type match predicates.
53 * @return A predicate match builder based on current result type
55 @NonNull MatchBuilderPath<T, T> matching();
58 QueryExpression<T> build();