1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.core.metapath.item.function;
7   
8   import java.util.stream.Stream;
9   
10  import dev.metaschema.core.metapath.DynamicContext;
11  import dev.metaschema.core.metapath.item.ICollectionValue;
12  import dev.metaschema.core.metapath.item.IItem;
13  import dev.metaschema.core.metapath.item.ISequence;
14  import edu.umd.cs.findbugs.annotations.NonNull;
15  
16  /**
17   * A common interface for all key specifier implementations.
18   */
19  @FunctionalInterface
20  public interface IKeySpecifier {
21  
22    /**
23     * Perform a lookup on the provided target item.
24     *
25     * @param targetItem
26     *          the item to query
27     * @param dynamicContext
28     *          the dynamic context to use for expression evaluation
29     * @param focus
30     *          the focus item for expression evaluation
31     * @return a stream of collection values matching this key specifier
32     */
33    Stream<? extends ICollectionValue> lookup(
34        @NonNull IItem targetItem,
35        @NonNull DynamicContext dynamicContext,
36        @NonNull ISequence<?> focus);
37  }