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;
15 import org.opendaylight.yangtools.yang.binding.Key;
16 import org.opendaylight.yangtools.yang.binding.KeyAware;
19 * Intermediate Query builder stage, which allows the specification of the query result type to be built up via
20 * {@link #extractChild(Class)} and {@link #extractChild(Class, Class)} methods. Once completed, use either
21 * {@link #build()} to create a simple query, or {@link #matching()} to transition to specify predicates.
23 * @param <T> Query result type
26 public interface DescendantQueryBuilder<T extends DataObject> extends StructuralBuilder<QueryExpression<T>> {
28 * Add a child path component to the specification of what needs to be extracted. This method, along with its
29 * alternatives, can be used to specify which object type to select from the root path.
31 * @param <N> Container type
32 * @param childClass child container class
33 * @return This builder
34 * @throws NullPointerException if childClass is null
36 <N extends ChildOf<? super T>> @NonNull DescendantQueryBuilder<N> extractChild(Class<N> childClass);
39 * Add a child path component to the specification of what needs to be extracted, specifying an exact match in
40 * a keyed list. This method, along with its alternatives, can be used to specify which object type to select from
43 * @param <N> List type
45 * @param listKey List key
46 * @return This builder
47 * @throws NullPointerException if childClass is null
49 <N extends KeyAware<K> & ChildOf<? super T>, K extends Key<N>> @NonNull DescendantQueryBuilder<N> extractChild(
50 Class<@NonNull N> listItem, K listKey);
53 * Add a child path component to the specification of what needs to be extracted. This method, along with its
54 * alternatives, can be used to specify which object type to select from the root path.
56 * @param <C> Case type
57 * @param <N> Container type
58 * @param caseClass child case class
59 * @param childClass child container class
60 * @return This builder
61 * @throws NullPointerException if any argument is null
63 <C extends ChoiceIn<? super T> & DataObject, N extends ChildOf<? super C>>
64 @NonNull DescendantQueryBuilder<N> extractChild(Class<C> caseClass, Class<N> childClass);
67 * Start specifying type match predicates.
69 * @return A predicate match builder based on current result type
71 @NonNull MatchBuilderPath<T, T> matching();
74 QueryExpression<T> build();