Yet another fix for javadoc
[mdsal.git] / binding / mdsal-binding-api / src / main / java / org / opendaylight / mdsal / binding / api / query / DescendantQueryBuilder.java
1 /*
2  * Copyright (c) 2020 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.mdsal.binding.api.query;
9
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.Identifiable;
16 import org.opendaylight.yangtools.yang.binding.Identifier;
17
18 /**
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.
22  *
23  * @param <T> Query result type
24  */
25 @Beta
26 public interface DescendantQueryBuilder<T extends DataObject> extends StructuralBuilder<QueryExpression<T>> {
27     /**
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.
30      *
31      * @param <N> Container type
32      * @param childClass child container class
33      * @return This builder
34      * @throws NullPointerException if childClass is null
35      */
36     <N extends ChildOf<? super T>> @NonNull DescendantQueryBuilder<N> extractChild(Class<N> childClass);
37
38     /**
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
41      * the root path.
42      *
43      * @param <N> List type
44      * @param <K> Key type
45      * @param listKey List key
46      * @return This builder
47      * @throws NullPointerException if childClass is null
48      */
49     <N extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<N>>
50         @NonNull DescendantQueryBuilder<N> extractChild(Class<@NonNull N> listItem, K listKey);
51
52     /**
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.
55      *
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
62      */
63     <C extends ChoiceIn<? super T> & DataObject, N extends ChildOf<? super C>>
64         @NonNull DescendantQueryBuilder<N> extractChild(Class<C> caseClass, Class<N> childClass);
65
66     /**
67      * Start specifying type match predicates.
68      *
69      * @return A predicate match builder based on current result type
70      */
71     @NonNull MatchBuilderPath<T, T> matching();
72
73     @Override
74     QueryExpression<T> build();
75 }