org.springframework.data.domain.Sort.forEach()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(185)

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

Sort.forEach介绍

暂无

代码示例

代码示例来源:origin: com.epam.reportportal/commons-dao

@Override
public DBObject toDBObject(AggregationOperationContext context) {
  BasicDBObject object = new BasicDBObject();
  sort.forEach(it -> object.put(it.getProperty(), it.isAscending() ? 1 : -1));
  return new BasicDBObject("$sort", object);
}

代码示例来源:origin: com.thinkbiganalytics.kylo/kylo-metadata-modeshape

@Override
protected void appendJoins(StringBuilder bldr, Pageable pageable, String filter) {
  List<String> sortProps = new ArrayList<>();
  if (pageable.getSort() != null) {
    pageable.getSort().forEach(o -> sortProps.add(o.getProperty()));
  }
  // TODO: template sorting does not currently work because a way hasn't been found yet to join
  // across reference properties, so the template associated with a feed cannot be joined.
  
  // If there is no filter then just perform the minimal joins needed to sort.
  if (!Strings.isNullOrEmpty(filter)) {
    appendJoins(bldr, filter);
  } else if (sortProps.contains(SORT_FEED_NAME)) {
    bldr.append("JOIN [tba:feedSummary] AS fs ON ISCHILDNODE(fs, e) ");
  } else if (sortProps.contains(SORT_CATEGORY_NAME)) {
    bldr.append("JOIN [tba:categoryDetails] AS cd ON ISCHILDNODE(e, cd) ");
    bldr.append("JOIN [tba:category] AS c ON ISCHILDNODE(cd, c) ");
  } else if (sortProps.contains(SORT_STATE)) {
    bldr.append("JOIN [tba:feedData] AS fdata ON ISCHILDNODE(fdata, e) ");
  }
}

代码示例来源:origin: am.ik.home/uaa-client

static UriComponentsBuilder withPageable(UriComponentsBuilder builder,
      Pageable pageable) {
    builder.queryParam("page", pageable.getPageNumber()).queryParam("size",
        pageable.getPageSize());
    if (pageable.getSort() != null) {
      StringBuilder sb = new StringBuilder();
      pageable.getSort().forEach(order -> {
        sb.append(order.getProperty()).append(",").append(order.getDirection());
      });
      builder.queryParam("sort", sb.toString());
    }
    return builder;
  }
}

相关文章