public interface CategoryQuery extends MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
MAX_OFFSET, MIN_OFFSET
Modifier and Type | Method and Description |
---|---|
default CategoryQuery |
byExternalId(String externalId) |
default CategoryQuery |
byId(String id) |
default CategoryQuery |
byIsRoot() |
default CategoryQuery |
byName(Locale locale,
String name) |
default CategoryQuery |
bySlug(Locale locale,
String slug) |
static CategoryQuery |
of() |
CategoryQuery |
plusExpansionPaths(Function<CategoryExpansionModel<Category>,ExpansionPathContainer<Category>> m)
Creates a new object with the properties of the old object but adds a new expansion path to it by using meta models.
|
CategoryQuery |
plusPredicates(Function<CategoryQueryModel,QueryPredicate<Category>> m)
Returns a new instance with the new predicate appended (AND semantics).
|
CategoryQuery |
plusPredicates(List<QueryPredicate<Category>> queryPredicates)
Returns a new instance with the new predicate list appended to the existing predicates (AND semantic).
|
CategoryQuery |
plusPredicates(QueryPredicate<Category> queryPredicate)
Returns a new instance with the new predicate appended to the existing predicates (AND semantic).
|
CategoryQuery |
plusSort(Function<CategoryQueryModel,QuerySort<Category>> m)
Returns a query with the sort expression appended to the existing ones.
|
CategoryQuery |
plusSort(List<QuerySort<Category>> sort)
Returns a query with the sort expressions appended to the existing ones.
|
CategoryQuery |
plusSort(QuerySort<Category> sort)
Returns a query with the sort expression appended to the existing ones.
|
static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResult<Category>> |
resultTypeReference()
Creates a container which contains the full Java type information to deserialize the query result (NOT this class) from JSON.
|
CategoryQuery |
withExpansionPaths(Function<CategoryExpansionModel<Category>,ExpansionPathContainer<Category>> 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. |
CategoryQuery |
withFetchTotal(boolean fetchTotal)
Enables/disables a flag it the total amount of items should be counted.
|
CategoryQuery |
withLimit(Long limit)
Creates a new instance which a limited amount of results.
|
CategoryQuery |
withOffset(Long offset)
Returns a new query with the new offset as offset.
|
CategoryQuery |
withPredicates(Function<CategoryQueryModel,QueryPredicate<Category>> predicateFunction)
Returns a new instance with the new predicate as only predicate.
|
CategoryQuery |
withPredicates(List<QueryPredicate<Category>> queryPredicates)
Returns a new instance with the new predicate list as predicates.
|
CategoryQuery |
withPredicates(QueryPredicate<Category> queryPredicate)
Returns a new instance with the new predicate as only predicate.
|
CategoryQuery |
withSort(Function<CategoryQueryModel,QuerySort<Category>> m)
Returns a query with the new sort as only sort parameter.
|
CategoryQuery |
withSort(List<QuerySort<Category>> sort)
Returns a query with the new sort list as only sort parameters.
|
CategoryQuery |
withSort(QuerySort<Category> sort)
Returns a query with the new sort as only sort parameter.
|
CategoryQuery |
withSortMulti(Function<CategoryQueryModel,List<QuerySort<Category>>> 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<Category>> resultTypeReference()
static CategoryQuery of()
CategoryQuery plusPredicates(Function<CategoryQueryModel,QueryPredicate<Category>> m)
MetaModelQueryDsl
plusPredicates
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
m
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.withPredicates(Function)
CategoryQuery plusPredicates(QueryPredicate<Category> queryPredicate)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
plusPredicates
in interface QueryDsl<Category,CategoryQuery>
queryPredicate
- the new predicateQueryDsl.withPredicates(QueryPredicate)
CategoryQuery plusPredicates(List<QueryPredicate<Category>> queryPredicates)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
plusPredicates
in interface QueryDsl<Category,CategoryQuery>
queryPredicates
- the new predicate listQueryDsl.withPredicates(List)
CategoryQuery plusSort(Function<CategoryQueryModel,QuerySort<Category>> m)
MetaModelQueryDsl
plusSort
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
m
- function given a meta model description of the model returns a list of QuerySort
MetaModelQueryDsl.withSort(Function)
CategoryQuery plusSort(List<QuerySort<Category>> sort)
QueryDsl
plusSort
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
plusSort
in interface QueryDsl<Category,CategoryQuery>
sort
- sort expressions how the results of the query should be sortedQueryDsl.withSort(List)
CategoryQuery plusSort(QuerySort<Category> sort)
QueryDsl
plusSort
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
plusSort
in interface QueryDsl<Category,CategoryQuery>
sort
- sort expression how the results of the query should be sortedQueryDsl.withSort(QuerySort)
CategoryQuery withPredicates(Function<CategoryQueryModel,QueryPredicate<Category>> predicateFunction)
MetaModelQueryDsl
withPredicates
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
predicateFunction
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.plusPredicates(Function)
CategoryQuery withPredicates(QueryPredicate<Category> queryPredicate)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
withPredicates
in interface QueryDsl<Category,CategoryQuery>
queryPredicate
- the new predicateQueryDsl.plusPredicates(QueryPredicate)
CategoryQuery withPredicates(List<QueryPredicate<Category>> queryPredicates)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
withPredicates
in interface QueryDsl<Category,CategoryQuery>
queryPredicates
- the new predicate listQueryDsl.plusPredicates(List)
CategoryQuery withSort(Function<CategoryQueryModel,QuerySort<Category>> m)
MetaModelQueryDsl
withSort
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
m
- function given a meta model description of the model returns a QuerySort
MetaModelQueryDsl.plusSort(Function)
CategoryQuery withSort(List<QuerySort<Category>> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
withSort
in interface QueryDsl<Category,CategoryQuery>
sort
- list of sorts how the results of the query should be sortedQueryDsl.plusSort(List)
CategoryQuery withSort(QuerySort<Category> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
withSort
in interface QueryDsl<Category,CategoryQuery>
sort
- sort expression how the results of the query should be sortedQueryDsl.plusSort(QuerySort)
CategoryQuery withSortMulti(Function<CategoryQueryModel,List<QuerySort<Category>>> m)
MetaModelQueryDsl
withSortMulti
in interface MetaModelQueryDsl<Category,CategoryQuery,CategoryQueryModel,CategoryExpansionModel<Category>>
m
- function given a meta model description of the model returns a list of QuerySort
MetaModelQueryDsl.plusSort(List)
,
MetaModelQueryDsl.withSort(Function)
CategoryQuery plusExpansionPaths(Function<CategoryExpansionModel<Category>,ExpansionPathContainer<Category>> 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<Category,CategoryQuery,CategoryExpansionModel<Category>>
m
- function to use the meta model for expansions to create an expansion pathCategoryQuery withExpansionPaths(Function<CategoryExpansionModel<Category>,ExpansionPathContainer<Category>> 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<Category,CategoryQuery,CategoryExpansionModel<Category>>
m
- function to use the meta model for expansions to create an expansion pathCategoryQuery withFetchTotal(boolean fetchTotal)
QueryDsl
If fetchTotal
is true then PagedQueryResult.getTotal()
is null.
withFetchTotal
in interface QueryDsl<Category,CategoryQuery>
fetchTotal
- enable the total count if true (default on the construction of the QueryDsl).QueryDsl
as this instance but with the updated flagCategoryQuery withLimit(Long limit)
QueryDsl
withLimit
in interface QueryDsl<Category,CategoryQuery>
limit
- the maximum amount of items of T
which should be included in the PagedQueryResult
.PagedQueryResult.getResults()
CategoryQuery withOffset(Long offset)
QueryDsl
withOffset
in interface QueryDsl<Category,CategoryQuery>
offset
- the number of items which should be omitted in the query result.default CategoryQuery bySlug(Locale locale, String slug)
default CategoryQuery byName(Locale locale, String name)
default CategoryQuery byId(String id)
default CategoryQuery byIsRoot()
default CategoryQuery byExternalId(String externalId)