Class QueryByExampleDataFetcher<T>

java.lang.Object
org.springframework.graphql.data.query.QueryByExampleDataFetcher<T>
Type Parameters:
T - returned result type

public abstract class QueryByExampleDataFetcher<T> extends Object
Main class to create a DataFetcher from a Query By Example repository. To create an instance, use one of the following:

For example:

 interface BookRepository extends
         Repository<Book, String>, QueryByExampleExecutor<Book>{}

 TypeRuntimeWiring wiring = … ;
 BookRepository repository = … ;

 DataFetcher<?> forMany =
         wiring.dataFetcher("books", QueryByExampleDataFetcher.builder(repository).many());

 DataFetcher<?> forSingle =
         wiring.dataFetcher("book", QueryByExampleDataFetcher.builder(repository).single());
 

See methods on QueryByExampleDataFetcher.Builder and QueryByExampleDataFetcher.ReactiveBuilder for further options on result projections and sorting.

QueryByExampleDataFetcher exposes a RuntimeWiringConfigurer that can auto-register repositories annotated with @GraphQlRepository.

Since:
1.0.0
Author:
Greg Turnquist, Rossen Stoyanchev
See Also: