Interface PageResponse<T>
-
- Type Parameters:
T- object type listed in page
- All Superinterfaces:
Iterable<T>
- All Known Implementing Classes:
PageResponseImpl
public interface PageResponse<T> extends Iterable<T>
Abstract interface for pagination information. See Spring Data Commons, but more flat design and independent of Spring libraries. TODO: add Builder, @see PageRequest
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<T>getContent()intgetNumber()Returns the number of the currentPageResponse.intgetNumberOfElements()Returns the number of elements currently on thisPageResponse.PageRequestgetPageRequest()intgetSize()Returns the size of thePageResponse.SortinggetSorting()longgetTotalElements()Returns the total amount of elements.intgetTotalPages()Returns the number of total pages.booleanhasContent()Returns whether thePageResponsehas content at all.booleanhasNext()Returns if there is a nextPageResponse.booleanhasPrevious()Returns if there is a previousPageResponse.booleanisFirst()Returns whether the currentPageResponseis the first one.booleanisLast()Returns whether the currentPageResponseis the last one.PageRequestnextPageRequest()Returns thePageRequestto request the nextPageResponse.PageRequestpreviousPageRequest()Returns thePageRequestto request the previousPageResponse.voidsetContent(List<T> content)Allows to set the content (needed in case of content has to be converted/casted)-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
-
-
-
Method Detail
-
setContent
void setContent(List<T> content)
Allows to set the content (needed in case of content has to be converted/casted)- Parameters:
content- list of content/objects of this page
-
getNumber
int getNumber()
Returns the number of the currentPageResponse. Is always non-negative.- Returns:
- the number of the current
PageResponse.
-
getNumberOfElements
int getNumberOfElements()
Returns the number of elements currently on thisPageResponse.- Returns:
- the number of elements currently on this
PageResponse.
-
getPageRequest
PageRequest getPageRequest()
- Returns:
- the PageRequest used to get this PageResponse
-
getSize
int getSize()
Returns the size of thePageResponse.- Returns:
- the size of the
PageResponse.
-
getSorting
Sorting getSorting()
- Returns:
- the sorting parameters for the
PageResponse.
-
getTotalElements
long getTotalElements()
Returns the total amount of elements.- Returns:
- the total amount of elements
-
getTotalPages
int getTotalPages()
Returns the number of total pages.- Returns:
- the number of total pages
-
hasContent
boolean hasContent()
Returns whether thePageResponsehas content at all.- Returns:
- whether the
PageResponsehas content at all.
-
hasNext
boolean hasNext()
Returns if there is a nextPageResponse.- Returns:
- if there is a next
PageResponse.
-
hasPrevious
boolean hasPrevious()
Returns if there is a previousPageResponse.- Returns:
- if there is a previous
PageResponse.
-
isFirst
boolean isFirst()
Returns whether the currentPageResponseis the first one.- Returns:
- whether the current
PageResponseis the first one.
-
isLast
boolean isLast()
Returns whether the currentPageResponseis the last one.- Returns:
- whether the current
PageResponseis the last one.
-
nextPageRequest
PageRequest nextPageRequest()
Returns thePageRequestto request the nextPageResponse. Can be null in case the currentPageResponseis already the last one. Clients should checkhasNext()before calling this method to make sure they receive a non-null value.- Returns:
- the
PageRequestto request the nextPageResponse
-
previousPageRequest
PageRequest previousPageRequest()
Returns thePageRequestto request the previousPageResponse. Can be null in case the currentPageResponseis already the first one. Clients should checkhasPrevious()before calling this method make sure receive a non-null value.- Returns:
- the
PageRequestto request the previousPageResponse
-
-