A factory for queries. @see Query
| 12 | * @see Query |
| 13 | */ |
| 14 | public interface QueryFactory { |
| 15 | |
| 16 | /** |
| 17 | * Creates a new query for the given type. |
| 18 | * |
| 19 | * @param datastore the datastore |
| 20 | * @param type the query type |
| 21 | * @param <T> the query type |
| 22 | * @return the new query |
| 23 | */ |
| 24 | default <T> Query<T> createQuery(Datastore datastore, Class<T> type, FindOptions options) { |
| 25 | return createQuery(datastore, type, options, null); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Creates and returns a {@link Query} for the given arguments. The last argument is optional and may be {@code null}. |
| 30 | * |
| 31 | * @param datastore the Datastore to use |
| 32 | * @param type the type of the result |
| 33 | * @param query the Document containing the query structure |
| 34 | * @param <T> the type of the result |
| 35 | * @return the query |
| 36 | */ |
| 37 | <T> Query<T> createQuery(Datastore datastore, Class<T> type, FindOptions options, @Nullable Document query); |
| 38 | |
| 39 | /** |
| 40 | * Creates and returns a {@link Query} for the given arguments. Default implementations of this method will simply delegate to {@link |
| 41 | * #createQuery(Datastore, Class, FindOptions)} with the last argument being {@code null}. |
| 42 | * |
| 43 | * @param datastore the Datastore to use |
| 44 | * @param collection the actual collection to query. This overrides any mapped on collection on type. |
| 45 | * @param type the type of the result |
| 46 | * @param <T> the type of the result |
| 47 | * @return the query |
| 48 | * @see #createQuery(Datastore, Class, FindOptions) |
| 49 | * @deprecated use {@link #createQuery(Datastore, Class, FindOptions, Document)} |
| 50 | */ |
| 51 | default <T> Query<T> createQuery(Datastore datastore, String collection, Class<T> type) { |
| 52 | return createQuery(datastore, type, new FindOptions().collection(collection), null); |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Creates an unvalidated {@link Query} typically for use in aggregation pipelines. |
| 57 | * |
| 58 | * @param datastore the Datastore to use |
| 59 | * @param <T> the type of the result |
| 60 | * @return the query |
| 61 | * @deprecated this method is no longer used |
| 62 | */ |
| 63 | @Deprecated(forRemoval = true) |
| 64 | default <T> Query<T> createQuery(Datastore datastore) { |
| 65 | throw new UnsupportedOperationException(); |
| 66 | } |
| 67 | } |
nothing calls this directly
no outgoing calls
no test coverage detected