org.springframework.data.gemfire.examples.domain.Address.getCountry()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(112)

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

Address.getCountry介绍

[英]Returns the country.
[中]返回国家。

代码示例

代码示例来源:origin: spring-projects/spring-gemfire-examples

  1. @Override
  2. public String toString() {
  3. return String.format("%1$s, %2$s - %3$s", getStreet(), getCity(), getCountry());
  4. }
  5. }

代码示例来源:origin: spring-projects/spring-gemfire-examples

  1. @SuppressWarnings("unchecked")
  2. public static void main(String args[]) throws IOException {
  3. if (args.length >= 1 && args[0].equalsIgnoreCase("partitionByCountry")) {
  4. log.debug("partitioning by country");
  5. partitionByCountry = true;
  6. }
  7. @SuppressWarnings("resource")
  8. ApplicationContext context = new ClassPathXmlApplicationContext("client/cache-config.xml");
  9. Region<OrderKey,Order> region = context.getBean(Region.class);
  10. //Create some orders
  11. Random rand = new Random(new Date().getTime());
  12. for (long orderId = 1; orderId <= 100; orderId++) {
  13. Address shipTo = new Address("Some Street","Some City",(orderId%3 == 0)?"UK":"US");
  14. Order order = new Order(orderId, (new Long(rand.nextInt(100)+1)),shipTo);
  15. OrderKey orderKey = getOrderKey(orderId,shipTo.getCountry());
  16. region.put(orderKey, order);
  17. }
  18. }

代码示例来源:origin: spring-projects/spring-gemfire-examples

  1. private void findOrders() {
  2. log.debug("looking for orders for customer ID 2");
  3. for (Order order: orderService.findOrdersByCustomerId(2L)) {
  4. log.debug("found order ID " + order.getId() + " " +
  5. order.getBillingAddress().getStreet() + " " +
  6. order.getBillingAddress().getCity() + " " +
  7. order.getBillingAddress().getCountry());
  8. for (LineItem lineItem: order.getLineItems()) {
  9. log.debug("product ID:" + lineItem.getProductId() +
  10. " quantity:" + lineItem.getAmount() +
  11. " unit price:" + lineItem.getUnitPrice().setScale(2,BigDecimal.ROUND_DOWN) +
  12. " total price:" + lineItem.getTotal().setScale(2,BigDecimal.ROUND_DOWN));
  13. }
  14. }
  15. }

相关文章