本文整理了Java中org.springframework.data.domain.Pageable.isPaged()
方法的一些代码示例,展示了Pageable.isPaged()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Pageable.isPaged()
方法的具体详情如下:
包路径:org.springframework.data.domain.Pageable
类名称:Pageable
方法名:isPaged
[英]Returns whether the current Pageable contains pagination information.
[中]返回当前分页表是否包含分页信息。
代码示例来源:origin: spring-projects/spring-data-jpa
/**
* Creates a new {@link TypedQuery} from the given {@link Specification}.
*
* @param spec can be {@literal null}.
* @param domainClass must not be {@literal null}.
* @param pageable must not be {@literal null}.
* @return
*/
protected <S extends T> TypedQuery<S> getQuery(@Nullable Specification<S> spec, Class<S> domainClass,
Pageable pageable) {
Sort sort = pageable.isPaged() ? pageable.getSort() : Sort.unsorted();
return getQuery(spec, domainClass, sort);
}
代码示例来源:origin: spring-projects/spring-data-mongodb
/**
* Configures the {@link Pageable} to use.
*
* @param pageable must not be {@literal null}
* @return
*/
public NearQuery with(Pageable pageable) {
Assert.notNull(pageable, "Pageable must not be 'null'.");
if (pageable.isPaged()) {
this.num = pageable.getOffset() + pageable.getPageSize();
this.skip = pageable.getOffset();
}
return this;
}
代码示例来源:origin: spring-projects/spring-data-jpa
/**
* Creates a new {@link TypedQuery} from the given {@link Specification}.
*
* @param spec can be {@literal null}.
* @param pageable must not be {@literal null}.
* @return
*/
protected TypedQuery<T> getQuery(@Nullable Specification<T> spec, Pageable pageable) {
Sort sort = pageable.isPaged() ? pageable.getSort() : Sort.unsorted();
return getQuery(spec, getDomainClass(), sort);
}
代码示例来源:origin: spring-projects/spring-data-jpa
/**
* Reads the given {@link TypedQuery} into a {@link Page} applying the given {@link Pageable} and
* {@link Specification}.
*
* @param query must not be {@literal null}.
* @param domainClass must not be {@literal null}.
* @param spec can be {@literal null}.
* @param pageable can be {@literal null}.
* @return
*/
protected <S extends T> Page<S> readPage(TypedQuery<S> query, final Class<S> domainClass, Pageable pageable,
@Nullable Specification<S> spec) {
if (pageable.isPaged()) {
query.setFirstResult((int) pageable.getOffset());
query.setMaxResults(pageable.getPageSize());
}
return PageableExecutionUtils.getPage(query.getResultList(), pageable,
() -> executeCountQuery(getCountQuery(spec, domainClass)));
}
代码示例来源:origin: spring-projects/spring-data-elasticsearch
private SearchRequest prepareScroll(Query query, long scrollTimeInMillis) {
SearchRequest request = new SearchRequest(toArray(query.getIndices()));
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
request.types(toArray(query.getTypes()));
request.scroll(TimeValue.timeValueMillis(scrollTimeInMillis));
if (query.getPageable().isPaged()) {
searchSourceBuilder.size(query.getPageable().getPageSize());
}
if (!isEmpty(query.getFields())) {
searchSourceBuilder.fetchSource(toArray(query.getFields()), null);
}
request.source(searchSourceBuilder);
return request;
}
代码示例来源:origin: spring-projects/spring-data-elasticsearch
if (pageable.isPaged()) {
代码示例来源:origin: spring-projects/spring-data-elasticsearch
if (query.getPageable().isPaged()) {
startRecord = query.getPageable().getPageNumber() * query.getPageable().getPageSize();
sourceBuilder.size(query.getPageable().getPageSize());
代码示例来源:origin: org.springframework.data/spring-data-mongodb
/**
* Configures the {@link Pageable} to use.
*
* @param pageable must not be {@literal null}
* @return
*/
public NearQuery with(Pageable pageable) {
Assert.notNull(pageable, "Pageable must not be 'null'.");
if (pageable.isPaged()) {
this.num = pageable.getOffset() + pageable.getPageSize();
this.skip = pageable.getOffset();
}
return this;
}
代码示例来源:origin: spring-projects/spring-data-neo4j
public String getCypherQuery(Pageable pageable, boolean forSlicing) {
String result = cypherQuery;
Sort sort = null;
if (pageable.isPaged() && pageable.getSort() != Sort.unsorted()) {
sort = pageable.getSort();
}
if (sort != Sort.unsorted()) {
// Custom queries in the OGM do not support pageable
result = addSorting(result, sort);
}
result = addPaging(result, pageable, forSlicing);
return result;
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Returns whether the current {@link Pageable} does not contain pagination information.
*
* @return
*/
default boolean isUnpaged() {
return !isPaged();
}
代码示例来源:origin: Blazebit/blaze-persistence
@Override
protected int getLimit(Pageable pageable) {
if (pageable.isPaged()) {
return pageable.getPageSize();
}
return Integer.MAX_VALUE;
}
代码示例来源:origin: com.blazebit/blaze-persistence-integration-spring-data-2.0
@Override
protected int getLimit(Pageable pageable) {
if (pageable.isPaged()) {
return pageable.getPageSize();
}
return Integer.MAX_VALUE;
}
代码示例来源:origin: Blazebit/blaze-persistence
@Override
protected int getOffset(Pageable pageable) {
if (pageable.isPaged()) {
return (int) pageable.getOffset();
}
return 0;
}
代码示例来源:origin: com.blazebit/blaze-persistence-integration-spring-data-2.0
@Override
protected int getOffset(Pageable pageable) {
if (pageable.isPaged()) {
return (int) pageable.getOffset();
}
return 0;
}
代码示例来源:origin: com.blazebit/blaze-persistence-integration-spring-data-2.1
@Override
protected int getLimit(Pageable pageable) {
if (pageable.isPaged()) {
return pageable.getPageSize();
}
return Integer.MAX_VALUE;
}
代码示例来源:origin: org.springframework.data/spring-data-jpa
/**
* Creates a new {@link TypedQuery} from the given {@link Specification}.
*
* @param spec can be {@literal null}.
* @param domainClass must not be {@literal null}.
* @param pageable must not be {@literal null}.
* @return
*/
protected <S extends T> TypedQuery<S> getQuery(@Nullable Specification<S> spec, Class<S> domainClass,
Pageable pageable) {
Sort sort = pageable.isPaged() ? pageable.getSort() : Sort.unsorted();
return getQuery(spec, domainClass, sort);
}
代码示例来源:origin: org.springframework.data/spring-data-jpa
/**
* Creates a new {@link TypedQuery} from the given {@link Specification}.
*
* @param spec can be {@literal null}.
* @param pageable must not be {@literal null}.
* @return
*/
protected TypedQuery<T> getQuery(@Nullable Specification<T> spec, Pageable pageable) {
Sort sort = pageable.isPaged() ? pageable.getSort() : Sort.unsorted();
return getQuery(spec, getDomainClass(), sort);
}
代码示例来源:origin: alibaba/sca-best-practice
protected <T> Page<T> readPage(final Class<T> clazz, TypedQuery<T> query, Pageable pageable,
@Nullable Specification<T> spec) {
if (pageable.isPaged()) {
query.setFirstResult((int)pageable.getOffset());
query.setMaxResults(pageable.getPageSize());
}
return PageableExecutionUtils.getPage(query.getResultList(), pageable,
() -> executeCountQuery(getCountQuery(clazz, spec)));
}
代码示例来源:origin: org.springframework.data/spring-data-keyvalue
@Override
public Page<T> findAll(Predicate predicate, Pageable pageable) {
AbstractCollQuery<T, ?> query = prepareQuery(predicate);
if (pageable.isPaged() || pageable.getSort().isSorted()) {
query.offset(pageable.getOffset());
query.limit(pageable.getPageSize());
if (pageable.getSort().isSorted()) {
query.orderBy(toOrderSpecifier(pageable.getSort(), builder));
}
}
return new PageImpl<>(query.fetchResults().getResults(), pageable, count(predicate));
}
代码示例来源:origin: spring-projects/spring-data-keyvalue
@Override
public Page<T> findAll(Predicate predicate, Pageable pageable) {
AbstractCollQuery<T, ?> query = prepareQuery(predicate);
if (pageable.isPaged() || pageable.getSort().isSorted()) {
query.offset(pageable.getOffset());
query.limit(pageable.getPageSize());
if (pageable.getSort().isSorted()) {
query.orderBy(toOrderSpecifier(pageable.getSort(), builder));
}
}
return new PageImpl<>(query.fetchResults().getResults(), pageable, count(predicate));
}
内容来源于网络,如有侵权,请联系作者删除!