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

x33g5p2x  于2022-01-26 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(104)

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

Pageable.hasPrevious介绍

[英]Returns whether there's a previous Pageable we can access from the current one. Will return false in case the current Pageable already refers to the first page.
[中]返回我们是否可以从当前页面访问上一个页面。如果当前页面已经指向第一页,则返回false。

代码示例

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

public boolean hasPrevious() {
  return delegate.hasPrevious();
}

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

public boolean hasPrevious() {
  return delegate.hasPrevious();
}

代码示例来源:origin: hatunet/spring-data-mybatis

/**
 * Calculate total mount.
 * @return if return -1 means can not judge ,need count from database.
 */
protected <X> long calculateTotal(Pageable pager, List<X> result) {
  if (pager.hasPrevious()) {
    if (CollectionUtils.isEmpty(result)) {
      return -1;
    }
    if (result.size() == pager.getPageSize()) {
      return -1;
    }
    return (pager.getPageNumber() - 1) * pager.getPageSize() + result.size();
  }
  if (result.size() < pager.getPageSize()) {
    return result.size();
  }
  return -1;
}

相关文章