public interface ZoneQuery extends MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
MAX_OFFSET, MIN_OFFSET
Modifier and Type | Method and Description |
---|---|
default ZoneQuery |
byCountry(com.neovisionaries.i18n.CountryCode countryCode)
Predicate which matches the country of a location, does not take the state into the consideration.
|
default ZoneQuery |
byLocation(Location location)
Predicate which matches the country and state of a location.
|
default ZoneQuery |
byName(String name) |
static ZoneQuery |
of() |
ZoneQuery |
plusExpansionPaths(Function<ZoneExpansionModel<Zone>,ExpansionPathContainer<Zone>> m)
Creates a new object with the properties of the old object but adds a new expansion path to it by using meta models.
|
ZoneQuery |
plusPredicates(Function<ZoneQueryModel,QueryPredicate<Zone>> m)
Returns a new instance with the new predicate appended (AND semantics).
|
ZoneQuery |
plusPredicates(List<QueryPredicate<Zone>> queryPredicates)
Returns a new instance with the new predicate list appended to the existing predicates (AND semantic).
|
ZoneQuery |
plusPredicates(QueryPredicate<Zone> queryPredicate)
Returns a new instance with the new predicate appended to the existing predicates (AND semantic).
|
ZoneQuery |
plusSort(Function<ZoneQueryModel,QuerySort<Zone>> m)
Returns a query with the sort expression appended to the existing ones.
|
ZoneQuery |
plusSort(List<QuerySort<Zone>> sort)
Returns a query with the sort expressions appended to the existing ones.
|
ZoneQuery |
plusSort(QuerySort<Zone> sort)
Returns a query with the sort expression appended to the existing ones.
|
static com.fasterxml.jackson.core.type.TypeReference<PagedQueryResult<Zone>> |
resultTypeReference()
Creates a container which contains the full Java type information to deserialize the query result (NOT this class) from JSON.
|
ZoneQuery |
withExpansionPaths(Function<ZoneExpansionModel<Zone>,ExpansionPathContainer<Zone>> 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. |
ZoneQuery |
withFetchTotal(boolean fetchTotal)
Enables/disables a flag it the total amount of items should be counted.
|
ZoneQuery |
withLimit(Long limit)
Creates a new instance which a limited amount of results.
|
ZoneQuery |
withOffset(Long offset)
Returns a new query with the new offset as offset.
|
ZoneQuery |
withPredicates(Function<ZoneQueryModel,QueryPredicate<Zone>> predicateFunction)
Returns a new instance with the new predicate as only predicate.
|
ZoneQuery |
withPredicates(List<QueryPredicate<Zone>> queryPredicates)
Returns a new instance with the new predicate list as predicates.
|
ZoneQuery |
withPredicates(QueryPredicate<Zone> queryPredicate)
Returns a new instance with the new predicate as only predicate.
|
ZoneQuery |
withSort(Function<ZoneQueryModel,QuerySort<Zone>> m)
Returns a query with the new sort as only sort parameter.
|
ZoneQuery |
withSort(List<QuerySort<Zone>> sort)
Returns a query with the new sort list as only sort parameters.
|
ZoneQuery |
withSort(QuerySort<Zone> sort)
Returns a query with the new sort as only sort parameter.
|
ZoneQuery |
withSortMulti(Function<ZoneQueryModel,List<QuerySort<Zone>>> 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<Zone>> resultTypeReference()
static ZoneQuery of()
ZoneQuery plusPredicates(Function<ZoneQueryModel,QueryPredicate<Zone>> m)
MetaModelQueryDsl
plusPredicates
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
m
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.withPredicates(Function)
ZoneQuery plusPredicates(QueryPredicate<Zone> queryPredicate)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
plusPredicates
in interface QueryDsl<Zone,ZoneQuery>
queryPredicate
- the new predicateQueryDsl.withPredicates(QueryPredicate)
ZoneQuery plusPredicates(List<QueryPredicate<Zone>> queryPredicates)
QueryDsl
plusPredicates
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
plusPredicates
in interface QueryDsl<Zone,ZoneQuery>
queryPredicates
- the new predicate listQueryDsl.withPredicates(List)
ZoneQuery plusSort(Function<ZoneQueryModel,QuerySort<Zone>> m)
MetaModelQueryDsl
plusSort
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
m
- function given a meta model description of the model returns a list of QuerySort
MetaModelQueryDsl.withSort(Function)
ZoneQuery plusSort(List<QuerySort<Zone>> sort)
QueryDsl
plusSort
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
plusSort
in interface QueryDsl<Zone,ZoneQuery>
sort
- sort expressions how the results of the query should be sortedQueryDsl.withSort(List)
ZoneQuery plusSort(QuerySort<Zone> sort)
QueryDsl
plusSort
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
plusSort
in interface QueryDsl<Zone,ZoneQuery>
sort
- sort expression how the results of the query should be sortedQueryDsl.withSort(QuerySort)
ZoneQuery withPredicates(Function<ZoneQueryModel,QueryPredicate<Zone>> predicateFunction)
MetaModelQueryDsl
withPredicates
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
predicateFunction
- function given a meta model description of the model return a QueryPredicate
MetaModelQueryDsl.plusPredicates(Function)
ZoneQuery withPredicates(QueryPredicate<Zone> queryPredicate)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
withPredicates
in interface QueryDsl<Zone,ZoneQuery>
queryPredicate
- the new predicateQueryDsl.plusPredicates(QueryPredicate)
ZoneQuery withPredicates(List<QueryPredicate<Zone>> queryPredicates)
QueryDsl
withPredicates
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
withPredicates
in interface QueryDsl<Zone,ZoneQuery>
queryPredicates
- the new predicate listQueryDsl.plusPredicates(List)
ZoneQuery withSort(Function<ZoneQueryModel,QuerySort<Zone>> m)
MetaModelQueryDsl
withSort
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
m
- function given a meta model description of the model returns a QuerySort
MetaModelQueryDsl.plusSort(Function)
ZoneQuery withSort(List<QuerySort<Zone>> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
withSort
in interface QueryDsl<Zone,ZoneQuery>
sort
- list of sorts how the results of the query should be sortedQueryDsl.plusSort(List)
ZoneQuery withSort(QuerySort<Zone> sort)
QueryDsl
withSort
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
withSort
in interface QueryDsl<Zone,ZoneQuery>
sort
- sort expression how the results of the query should be sortedQueryDsl.plusSort(QuerySort)
ZoneQuery withSortMulti(Function<ZoneQueryModel,List<QuerySort<Zone>>> m)
MetaModelQueryDsl
withSortMulti
in interface MetaModelQueryDsl<Zone,ZoneQuery,ZoneQueryModel,ZoneExpansionModel<Zone>>
m
- function given a meta model description of the model returns a list of QuerySort
MetaModelQueryDsl.plusSort(List)
,
MetaModelQueryDsl.withSort(Function)
ZoneQuery plusExpansionPaths(Function<ZoneExpansionModel<Zone>,ExpansionPathContainer<Zone>> 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<Zone,ZoneQuery,ZoneExpansionModel<Zone>>
m
- function to use the meta model for expansions to create an expansion pathZoneQuery withExpansionPaths(Function<ZoneExpansionModel<Zone>,ExpansionPathContainer<Zone>> 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<Zone,ZoneQuery,ZoneExpansionModel<Zone>>
m
- function to use the meta model for expansions to create an expansion pathZoneQuery withFetchTotal(boolean fetchTotal)
QueryDsl
If fetchTotal
is true then PagedQueryResult.getTotal()
is null.
withFetchTotal
in interface QueryDsl<Zone,ZoneQuery>
fetchTotal
- enable the total count if true (default on the construction of the QueryDsl).QueryDsl
as this instance but with the updated flagZoneQuery withLimit(Long limit)
QueryDsl
withLimit
in interface QueryDsl<Zone,ZoneQuery>
limit
- the maximum amount of items of T
which should be included in the PagedQueryResult
.PagedQueryResult.getResults()
ZoneQuery withOffset(Long offset)
QueryDsl
withOffset
in interface QueryDsl<Zone,ZoneQuery>
offset
- the number of items which should be omitted in the query result.default ZoneQuery byCountry(com.neovisionaries.i18n.CountryCode countryCode)
byLocation(io.sphere.sdk.zones.Location)
.countryCode
- the country to query fordefault ZoneQuery byLocation(Location location)
byCountry(com.neovisionaries.i18n.CountryCode)
.location
- the location to query for