T
- - type of item in page resultpublic class PagingWrapper<T> extends Object
Default implementation of paging metadata is OffsetBasedPagingMetadata
provided by
withMetadata(Page)
, but it is possible to provide custom PagingMetadata
implementation
such as cursor-based and so on. If result set represents only non-paging list, it should be created with default
constructor PagingWrapper(Page)
, where paging info is not provided.
Example of usage:
PagefoundOrders = service.findOrders(request); Page resultList = foundOrders.map(toRpc()); return PagingWrapper.withMetadata(resultList);
Constructor and Description |
---|
PagingWrapper(org.springframework.data.domain.Page<T> data)
Constructor of
PagingWrapper . |
PagingWrapper(org.springframework.data.domain.Page<T> data,
PagingMetadata paging)
Constructor of
PagingWrapper that allows to define custom paging metadata. |
Modifier and Type | Method and Description |
---|---|
List<T> |
getData()
Gets the content of the page.
|
PagingMetadata |
getPaging()
Gets the paging metadata.
|
static <T> PagingWrapper<T> |
withMetadata(org.springframework.data.domain.Page<T> data)
Constructor of
PagingWrapper which provides OffsetBasedPagingMetadata implementation of paging
metadata. |
static <T> PagingWrapper<T> |
withoutMetadata(List<T> list)
Constructor of
PagingWrapper without paging metadata. |
public PagingWrapper(org.springframework.data.domain.Page<T> data)
PagingWrapper
.data
- the content of this page, must not be null.public PagingWrapper(org.springframework.data.domain.Page<T> data, PagingMetadata paging)
PagingWrapper
that allows to define custom paging metadata.data
- the content of this page, must not be null.paging
- the custom paging metadata, must not be null.public static <T> PagingWrapper<T> withMetadata(org.springframework.data.domain.Page<T> data)
PagingWrapper
which provides OffsetBasedPagingMetadata
implementation of paging
metadata.data
- the content of this page, must not be null.public static <T> PagingWrapper<T> withoutMetadata(List<T> list)
PagingWrapper
without paging metadata. Instead of it provided only data
element which contains list
.list
- of data, must not be null.public PagingMetadata getPaging()
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.