com.vaadin.flow.data.provider.Query.getLimit()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(108)

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

Query.getLimit介绍

[英]Gets the limit of items to fetch. The limit is only used when fetching items, but not when counting the number of available items.

Note: It is possible that offset + limit > item count
[中]获取要获取的项的限制。该限制仅在获取项目时使用,但在计算可用项目的数量时不使用。
注意:有可能是偏移+限制>项目计数

代码示例

代码示例来源:origin: com.vaadin/flow-data

@Override
public int getLimit() {
  isLimitCalled = true;
  return super.getLimit();
}

代码示例来源:origin: com.vaadin/flow-data

@Override
public Stream<T> fetch(Query<T, SerializablePredicate<T>> query) {
  Stream<T> stream = getFilteredStream(query);
  Optional<Comparator<T>> comparing = Stream
      .of(query.getInMemorySorting(), sortOrder)
      .filter(Objects::nonNull)
      .reduce((c1, c2) -> c1.thenComparing(c2));
  if (comparing.isPresent()) {
    stream = stream.sorted(comparing.get());
  }
  return stream.skip(query.getOffset()).limit(query.getLimit());
}

代码示例来源:origin: com.vaadin/flow-data

private Query<T, F> mixInSortOrders(Query<T, F> query) {
  if (sortOrders.isEmpty()) {
    return query;
  }
  Set<String> sortedPropertyNames = query.getSortOrders().stream()
      .map(SortOrder::getSorted).collect(Collectors.toSet());
  List<QuerySortOrder> combinedSortOrders = Stream
      .concat(query.getSortOrders().stream(),
          sortOrders.stream()
              .filter(order -> !sortedPropertyNames
                  .contains(order.getSorted())))
      .collect(Collectors.toList());
  return new Query<>(query.getOffset(), query.getLimit(),
      combinedSortOrders, query.getInMemorySorting(),
      query.getFilter().orElse(null));
}

代码示例来源:origin: com.holon-platform.vaadin/holon-vaadin-flow

if (query.getLimit() < Integer.MAX_VALUE) {
  q.limit(query.getLimit());
  q.offset(query.getOffset());

代码示例来源:origin: com.vaadin/flow-data

@Override
public Stream<T> fetch(Query<T, F> t) {
  return dataProvider.fetch(new Query<>(t.getOffset(), t.getLimit(),
      t.getSortOrders(), t.getInMemorySorting(), getFilter(t)));
}

代码示例来源:origin: com.vaadin/flow-data

@Override
public int size(Query<T, F> t) {
  return dataProvider.size(new Query<>(t.getOffset(), t.getLimit(),
      t.getSortOrders(), t.getInMemorySorting(), getFilter(t)));
}

相关文章