public interface CustomerQuery extends MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
MAX_OFFSET, MIN_OFFSET
Modifier and Type | Method and Description |
---|---|
default CustomerQuery |
byEmail(String email) |
static CustomerQuery |
of() |
CustomerQuery |
plusExpansionPaths(Function<CustomerExpansionModel<Customer>,ExpansionPathContainer<Customer>> m)
Creates a new object with the properties of the old object but adds a new expansion path to it by using meta models.
|
CustomerQuery |
plusPredicates(Function<CustomerQueryModel,QueryPredicate<Customer>> m)
Returns a new instance with the new predicate appended (AND semantics).
|
CustomerQuery |
plusPredicates(List<QueryPredicate<Customer>> queryPredicates)
Returns a new instance with the new predicate list appended to the existing predicates (AND semantic).
|
CustomerQuery |
plusPredicates(QueryPredicate<Customer> queryPredicate)
Returns a new instance with the new predicate appended to the existing predicates (AND semantic).
|
CustomerQuery |
plusSort(Function<CustomerQueryModel,QuerySort<Customer>> m)
Returns a query with the sort expression appended to the existing ones.
|
CustomerQuery |
plusSort(List<QuerySort<Customer>> sort)
Returns a query with the sort expressions appended to the existing ones.
|
CustomerQuery |
plusSort(QuerySort<Customer> sort)
Returns a query with the sort expression appended to the existing ones.
|
static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResult<Customer>> |
resultTypeReference()
Creates a container which contains the full Java type information to deserialize the query result (NOT this class) from JSON.
|
CustomerQuery |
withExpansionPaths(Function<CustomerExpansionModel<Customer>,ExpansionPathContainer<Customer>> m)
Creates a new object with the properties of the old object but replaces all expansion paths with a single
expansionPath by using meta models. |
CustomerQuery |
withFetchTotal(boolean fetchTotal)
Enables/disables a flag it the total amount of items should be counted.
|
CustomerQuery |
withLimit(Long limit)
Creates a new instance which a limited amount of results.
|
CustomerQuery |
withOffset(Long offset)
Returns a new query with the new offset as offset.
|
CustomerQuery |
withPredicates(Function<CustomerQueryModel,QueryPredicate<Customer>> predicateFunction)
Returns a new instance with the new predicate as only predicate.
|
CustomerQuery |
withPredicates(List<QueryPredicate<Customer>> queryPredicates)
Returns a new instance with the new predicate list as predicates.
|
CustomerQuery |
withPredicates(QueryPredicate<Customer> queryPredicate)
Returns a new instance with the new predicate as only predicate.
|
CustomerQuery |
withSort(Function<CustomerQueryModel,QuerySort<Customer>> m)
Returns a query with the new sort as only sort parameter.
|
CustomerQuery |
withSort(List<QuerySort<Customer>> sort)
Returns a query with the new sort list as only sort parameters.
|
CustomerQuery |
withSort(QuerySort<Customer> sort)
Returns a query with the new sort as only sort parameter.
|
CustomerQuery |
withSortMulti(Function<CustomerQueryModel,List<QuerySort<Customer>>> m)
Returns a query with the new sort list as only sort parameters.
|
plusPredicates, plusSort, withPredicates, withQueryParam, withSort
withLimit, withOffset
endpoint, expansionPaths, fetchTotal, limit, offset, predicates, sort
deserialize, toQuery
canDeserialize, httpRequestIntent
plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, plusExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths, withExpansionPaths
static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResult<Customer>> resultTypeReference()
static CustomerQuery of()
CustomerQuery plusPredicates(Function<CustomerQueryModel,QueryPredicate<Customer>> m)
MetaModelQueryDsl
plusPredicates
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
m
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.withPredicates(Function)
CustomerQuery plusPredicates(QueryPredicate<Customer> queryPredicate)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
plusPredicates
in interface QueryDsl<Customer,CustomerQuery>
queryPredicate
- the new predicateQueryDsl.withPredicates(QueryPredicate)
CustomerQuery plusPredicates(List<QueryPredicate<Customer>> queryPredicates)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
plusPredicates
in interface QueryDsl<Customer,CustomerQuery>
queryPredicates
- the new predicate listQueryDsl.withPredicates(List)
CustomerQuery plusSort(Function<CustomerQueryModel,QuerySort<Customer>> m)
MetaModelQueryDsl
plusSort
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
m
- function given a meta model description of the model returns a list of QuerySort
MetaModelQueryDsl.withSort(Function)
CustomerQuery plusSort(List<QuerySort<Customer>> sort)
QueryDsl
plusSort
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
plusSort
in interface QueryDsl<Customer,CustomerQuery>
sort
- sort expressions how the results of the query should be sortedQueryDsl.withSort(List)
CustomerQuery plusSort(QuerySort<Customer> sort)
QueryDsl
plusSort
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
plusSort
in interface QueryDsl<Customer,CustomerQuery>
sort
- sort expression how the results of the query should be sortedQueryDsl.withSort(QuerySort)
CustomerQuery withPredicates(Function<CustomerQueryModel,QueryPredicate<Customer>> predicateFunction)
MetaModelQueryDsl
withPredicates
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
predicateFunction
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.plusPredicates(Function)
CustomerQuery withPredicates(QueryPredicate<Customer> queryPredicate)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
withPredicates
in interface QueryDsl<Customer,CustomerQuery>
queryPredicate
- the new predicateQueryDsl.plusPredicates(QueryPredicate)
CustomerQuery withPredicates(List<QueryPredicate<Customer>> queryPredicates)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
withPredicates
in interface QueryDsl<Customer,CustomerQuery>
queryPredicates
- the new predicate listQueryDsl.plusPredicates(List)
CustomerQuery withSort(Function<CustomerQueryModel,QuerySort<Customer>> m)
MetaModelQueryDsl
withSort
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
m
- function given a meta model description of the model returns a QuerySort
MetaModelQueryDsl.plusSort(Function)
CustomerQuery withSort(List<QuerySort<Customer>> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
withSort
in interface QueryDsl<Customer,CustomerQuery>
sort
- list of sorts how the results of the query should be sortedQueryDsl.plusSort(List)
CustomerQuery withSort(QuerySort<Customer> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
withSort
in interface QueryDsl<Customer,CustomerQuery>
sort
- sort expression how the results of the query should be sortedQueryDsl.plusSort(QuerySort)
CustomerQuery withSortMulti(Function<CustomerQueryModel,List<QuerySort<Customer>>> m)
MetaModelQueryDsl
withSortMulti
in interface MetaModelQueryDsl<Customer,CustomerQuery,CustomerQueryModel,CustomerExpansionModel<Customer>>
m
- function given a meta model description of the model returns a list of QuerySort
MetaModelQueryDsl.plusSort(List)
,
MetaModelQueryDsl.withSort(Function)
CustomerQuery plusExpansionPaths(Function<CustomerExpansionModel<Customer>,ExpansionPathContainer<Customer>> m)
MetaModelReferenceExpansionDsl
An example in the product projection context:
final ProductProjectionByIdGet fetch1 = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .plusExpansionPaths(m -> m.categories()); assertThat(fetch1.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch1.plusExpansionPaths(m -> m.productType()); assertThat(fetch2.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"), ExpansionPath.of("productType"))) .isEqualTo(listOf(fetch1.expansionPaths(), ExpansionPath.of("productType"))); //this is equivalent to final ExpansionPath<ProductProjection> categoryExpand = ProductProjectionExpansionModel.of().categories().expansionPaths().get(0); final ExpansionPath<ProductProjection> productTypeExpand = ProductProjectionExpansionModel.of().productType().expansionPaths().get(0); final ProductProjectionByIdGet fetchB = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .withExpansionPaths(asList(categoryExpand, productTypeExpand)); assertThat(fetchB.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"), ExpansionPath.of("productType")));
See the test code.
plusExpansionPaths
in interface MetaModelReferenceExpansionDsl<Customer,CustomerQuery,CustomerExpansionModel<Customer>>
m
- function to use the meta model for expansions to create an expansion pathCustomerQuery withExpansionPaths(Function<CustomerExpansionModel<Customer>,ExpansionPathContainer<Customer>> m)
MetaModelReferenceExpansionDsl
expansionPath
by using meta models.
An example in the product projection context:
final ProductProjectionByIdGet fetch = ProductProjectionByIdGet.of("id", ProductProjectionType.CURRENT) .plusExpansionPaths(ProductProjectionExpansionModel.of().categories()); assertThat(fetch.expansionPaths()) .isEqualTo(asList(ExpansionPath.of("categories[*]"))); final ProductProjectionByIdGet fetch2 = fetch.withExpansionPaths(m -> m.productType()); assertThat(fetch.expansionPaths()).overridingErrorMessage("old object is unchanged") .isEqualTo(asList(ExpansionPath.of("categories[*]"))); assertThat(fetch2.expansionPaths()).isEqualTo(asList(ExpansionPath.of("productType"))); assertThat(fetch2).isNotSameAs(fetch);
See the test code.
withExpansionPaths
in interface MetaModelReferenceExpansionDsl<Customer,CustomerQuery,CustomerExpansionModel<Customer>>
m
- function to use the meta model for expansions to create an expansion pathCustomerQuery withFetchTotal(boolean fetchTotal)
QueryDsl
If fetchTotal
is true then PagedQueryResult.getTotal()
is null.
withFetchTotal
in interface QueryDsl<Customer,CustomerQuery>
fetchTotal
- enable the total count if true (default on the construction of the QueryDsl).QueryDsl
as this instance but with the updated flagCustomerQuery withLimit(Long limit)
QueryDsl
withLimit
in interface QueryDsl<Customer,CustomerQuery>
limit
- the maximum amount of items of T
which should be included in the PagedQueryResult
.PagedQueryResult.getResults()
CustomerQuery withOffset(Long offset)
QueryDsl
withOffset
in interface QueryDsl<Customer,CustomerQuery>
offset
- the number of items which should be omitted in the query result.default CustomerQuery byEmail(String email)