Add MatchBuilderPath.BooleanLeafReference
[mdsal.git] / binding / mdsal-binding-api / src / main / java / org / opendaylight / mdsal / binding / api / query / MatchBuilderPath.java
index e753d58bc98d16aca3cf6de1aee2c6c5b1dcaf10..11943c867ec850eafcc4bdfa75725cdc109adab7 100644 (file)
@@ -15,6 +15,8 @@ import org.opendaylight.yangtools.yang.binding.BaseIdentity;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
 import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.Identifier;
 import org.opendaylight.yangtools.yang.binding.TypeObject;
 import org.opendaylight.yangtools.yang.common.Empty;
 import org.opendaylight.yangtools.yang.common.Uint16;
@@ -46,6 +48,29 @@ public interface MatchBuilderPath<O extends DataObject, T extends DataObject> ex
     <C extends ChoiceIn<? super T> & DataObject, N extends ChildOf<? super C>>
         @NonNull MatchBuilderPath<O, N> extractChild(Class<C> caseClass, Class<N> childClass);
 
+    /**
+     * Add a child path component to the specification of what needs to be extracted, specifying an exact match in
+     * a keyed list. This method, along with its alternatives, can be used to specify which object type to select from
+     * the root path.
+     *
+     * @param <N> List type
+     * @param <K> Key type
+     * @param listKey List key
+     * @return This builder
+     * @throws NullPointerException if childClass is null
+     */
+    <N extends Identifiable<K> & ChildOf<? super T>, K extends Identifier<N>>
+        @NonNull MatchBuilderPath<O, N> extractChild(Class<@NonNull N> listItem, K listKey);
+
+    /**
+     * Match an {@code boolean} leaf's value.
+     *
+     * @param methodRef method reference to the getter method
+     * @return A {@link ValueMatchBuilder}
+     * @throws NullPointerException if methodRef is null
+     */
+    @NonNull ValueMatchBuilder<O, Boolean> leaf(BooleanLeafReference<T> methodRef);
+
     /**
      * Match an {@code empty} leaf's value.
      *
@@ -182,6 +207,11 @@ public interface MatchBuilderPath<O extends DataObject, T extends DataObject> ex
         C dummyMethod(P parent);
     }
 
+    @FunctionalInterface
+    public interface BooleanLeafReference<P> extends LeafReference<P, Boolean> {
+
+    }
+
     @FunctionalInterface
     public interface EmptyLeafReference<P> extends LeafReference<P, Empty> {