io.sphere.sdk.zones.queries.ZoneQuery.byLocation()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中io.sphere.sdk.zones.queries.ZoneQuery.byLocation()方法的一些代码示例,展示了ZoneQuery.byLocation()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneQuery.byLocation()方法的具体详情如下:
包路径:io.sphere.sdk.zones.queries.ZoneQuery
类名称:ZoneQuery
方法名:byLocation

ZoneQuery.byLocation介绍

[英]Predicate which matches the country and state of a location. For ignoring the state use #byCountry(com.neovisionaries.i18n.CountryCode).
[中]匹配某个位置的国家和州的谓词。对于忽略州,请使用#byCountry(com.neovisionies.i18n.CountryCode)。

代码示例

代码示例来源:origin: com.commercetools.sunrise/common

private CompletionStage<Optional<Zone>> fetchZoneByCountry(final Location location) {
  final ZoneQuery request = ZoneQuery.of().byLocation(location);
  return sphereClient.execute(request)
      .thenApplyAsync(PagedResult::head);
}

代码示例来源:origin: commercetools/commercetools-jvm-sdk

private void locationCheck(final Location searchLocation, final Zone ... expected) {
    final PagedQueryResult<Zone> result = client().executeBlocking(ZoneQuery.of().byLocation(searchLocation));
    final Set<Zone> actual = new HashSet<>(result.getResults());
    assertThat(actual).isEqualTo(new HashSet<>(asList(expected)));
  }
}

相关文章