org.springframework.data.querydsl.QSort.getOrderSpecifiers()方法的使用及代码示例

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

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

QSort.getOrderSpecifiers介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-jpa

/**
 * Applies the given {@link OrderSpecifier}s to the given {@link JPQLQuery}. Potentially transforms the given
 * {@code OrderSpecifier}s to be able to injection potentially necessary left-joins.
 *
 * @param qsort must not be {@literal null}.
 * @param query must not be {@literal null}.
 */
private <T> JPQLQuery<T> addOrderByFrom(QSort qsort, JPQLQuery<T> query) {
  List<OrderSpecifier<?>> orderSpecifiers = qsort.getOrderSpecifiers();
  return query.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]));
}

代码示例来源:origin: spring-projects/spring-data-mongodb

/**
 * Converts the given {@link Sort} to {@link OrderSpecifier}.
 *
 * @param sort
 * @return
 */
protected List<OrderSpecifier<?>> toOrderSpecifiers(Sort sort) {
  if (sort instanceof QSort) {
    return ((QSort) sort).getOrderSpecifiers();
  }
  return sort.stream().map(this::toOrder).collect(Collectors.toList());
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

/**
 * Applies the given {@link Sort} to the given {@link SpringDataMongodbQuery}.
 *
 * @param query
 * @param sort
 * @return
 */
private SpringDataMongodbQuery<T> applySorting(SpringDataMongodbQuery<T> query, Sort sort) {
  // TODO: find better solution than instanceof check
  if (sort instanceof QSort) {
    List<OrderSpecifier<?>> orderSpecifiers = ((QSort) sort).getOrderSpecifiers();
    query.orderBy(orderSpecifiers.toArray(new OrderSpecifier<?>[orderSpecifiers.size()]));
    return query;
  }
  sort.stream().map(this::toOrder).forEach(query::orderBy);
  return query;
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Returns a new {@link QSort} consisting of the {@link OrderSpecifier}s of the current {@code QSort} combined with
 * the ones from the given {@code QSort}.
 *
 * @param sort can be {@literal null}.
 * @return
 */
public QSort and(QSort sort) {
  return sort == null ? this : and(sort.getOrderSpecifiers());
}

代码示例来源:origin: org.springframework.data/spring-data-jpa

/**
 * Applies the given {@link OrderSpecifier}s to the given {@link JPQLQuery}. Potentially transforms the given
 * {@code OrderSpecifier}s to be able to injection potentially necessary left-joins.
 *
 * @param qsort must not be {@literal null}.
 * @param query must not be {@literal null}.
 */
private <T> JPQLQuery<T> addOrderByFrom(QSort qsort, JPQLQuery<T> query) {
  List<OrderSpecifier<?>> orderSpecifiers = qsort.getOrderSpecifiers();
  return query.orderBy(orderSpecifiers.toArray(new OrderSpecifier[0]));
}

代码示例来源:origin: spring-projects/spring-data-keyvalue

/**
 * Transforms a plain {@link Order} into a QueryDsl specific {@link OrderSpecifier}.
 *
 * @param sort must not be {@literal null}.
 * @param builder must not be {@literal null}.
 * @return empty {@code OrderSpecifier<?>[]} when sort is {@literal null}.
 */
static OrderSpecifier<?>[] toOrderSpecifier(Sort sort, PathBuilder<?> builder) {
  Assert.notNull(sort, "Sort must not be null.");
  Assert.notNull(builder, "Builder must not be null.");
  List<OrderSpecifier<?>> specifiers = null;
  if (sort instanceof QSort) {
    specifiers = ((QSort) sort).getOrderSpecifiers();
  } else {
    specifiers = new ArrayList<>();
    for (Order order : sort) {
      specifiers.add(toOrderSpecifier(order, builder));
    }
  }
  return specifiers.toArray(new OrderSpecifier<?>[specifiers.size()]);
}

代码示例来源:origin: org.springframework.data/spring-data-keyvalue

/**
 * Transforms a plain {@link Order} into a QueryDsl specific {@link OrderSpecifier}.
 *
 * @param sort must not be {@literal null}.
 * @param builder must not be {@literal null}.
 * @return empty {@code OrderSpecifier<?>[]} when sort is {@literal null}.
 */
static OrderSpecifier<?>[] toOrderSpecifier(Sort sort, PathBuilder<?> builder) {
  Assert.notNull(sort, "Sort must not be null.");
  Assert.notNull(builder, "Builder must not be null.");
  List<OrderSpecifier<?>> specifiers = null;
  if (sort instanceof QSort) {
    specifiers = ((QSort) sort).getOrderSpecifiers();
  } else {
    specifiers = new ArrayList<>();
    for (Order order : sort) {
      specifiers.add(toOrderSpecifier(order, builder));
    }
  }
  return specifiers.toArray(new OrderSpecifier<?>[specifiers.size()]);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Transforms a plain {@link Order} into a QueryDsl specific {@link OrderSpecifier}.
 *
 * @param sort must not be {@literal null}.
 * @param builder must not be {@literal null}.
 * @return empty {@code OrderSpecifier<?>[]} when sort is {@literal null}.
 */
static OrderSpecifier<?>[] toOrderSpecifier(Sort sort, PathBuilder<?> builder) {
  Assert.notNull(sort, "Sort must not be null.");
  Assert.notNull(builder, "Builder must not be null.");
  List<OrderSpecifier<?>> specifiers = null;
  if (sort instanceof QSort) {
    specifiers = ((QSort) sort).getOrderSpecifiers();
  } else {
    specifiers = new ArrayList<>();
    for (Order order : sort) {
      specifiers.add(toOrderSpecifier(order, builder));
    }
  }
  return specifiers.toArray(new OrderSpecifier<?>[specifiers.size()]);
}

相关文章