Class QueryByExampleDataFetcher.Builder<T,R>

java.lang.Object
org.springframework.graphql.data.query.QueryByExampleDataFetcher.Builder<T,R>
Type Parameters:
T - domain type
R - result type
Enclosing class:
QueryByExampleDataFetcher<T>

public static class QueryByExampleDataFetcher.Builder<T,R> extends Object
Builder for a Query by Example-based DataFetcher. Note that builder instances are immutable and return a new instance of the builder when calling configuration methods.
  • Method Details

    • projectAs

      public <P> QueryByExampleDataFetcher.Builder<T,P> projectAs(Class<P> projectionType)
      Project results returned from the QueryByExampleExecutor into the target projectionType. Projection types can be either interfaces with property getters to expose or regular classes outside the entity type hierarchy for DTO projections.
      Parameters:
      projectionType - projection type
      Returns:
      a new QueryByExampleDataFetcher.Builder instance with all previously configured options and projectionType applied
    • sortBy

      public QueryByExampleDataFetcher.Builder<T,R> sortBy(org.springframework.data.domain.Sort sort)
      Apply a Sort order.
      Parameters:
      sort - the default sort order
      Returns:
      a new QueryByExampleDataFetcher.Builder instance with all previously configured options and Sort applied
    • single

      public DataFetcher<R> single()
      Build a DataFetcher to fetch single object instances.
    • many

      public DataFetcher<Iterable<R>> many()
      Build a DataFetcher to fetch many object instances.