PageResponse<T>, java.lang.Iterable<T>public class PageResponseImpl<T> extends java.lang.Object implements PageResponse<T>
| Constructor | Description |
|---|---|
PageResponseImpl() |
|
PageResponseImpl(java.util.List<T> content) |
Creates a new
PageResponseImpl with the given content. |
PageResponseImpl(java.util.List<T> content,
PageRequest pageRequest,
long total) |
Constructor of
PageResponseImpl with the given content and the given governing PageRequest. |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(java.lang.Object obj) |
|
java.util.List<T> |
getContent() |
|
int |
getNumber() |
Returns the number of the current
PageResponse. |
int |
getNumberOfElements() |
Returns the number of elements currently on this
PageResponse. |
PageRequest |
getPageRequest() |
|
int |
getSize() |
Returns the size of the
PageResponse. |
Sorting |
getSorting() |
|
long |
getTotalElements() |
Returns the total amount of elements.
|
int |
getTotalPages() |
Returns the number of total pages.
|
boolean |
hasContent() |
Returns whether the
PageResponse has content at all. |
int |
hashCode() |
|
boolean |
hasNext() |
Returns if there is a next
PageResponse. |
boolean |
hasPrevious() |
Returns if there is a previous
PageResponse. |
boolean |
isFirst() |
Returns whether the current
PageResponse is the first one. |
boolean |
isLast() |
Returns whether the current
PageResponse is the last one. |
java.util.Iterator<T> |
iterator() |
|
PageRequest |
nextPageRequest() |
Returns the
PageRequest to request the next PageResponse. |
PageRequest |
previousPageRequest() |
Returns the
PageRequest to request the previous PageResponse. |
void |
setContent(java.util.List<T> content) |
Allows to set the content (needed in case of content has to be converted/casted)
|
void |
setPageRequest(PageRequest pageRequest) |
|
void |
setTotalElements(long totalElements) |
|
java.lang.String |
toString() |
public PageResponseImpl()
public PageResponseImpl(java.util.List<T> content, PageRequest pageRequest, long total)
PageResponseImpl with the given content and the given governing PageRequest.content - the content of this page, must not be null.pageRequest - the paging information, can be null.total - the total amount of items available. The total might be adapted considering the length of the content given, if it is going to be the content of the last page. This is in place to mitigate inconsistenciespublic PageResponseImpl(java.util.List<T> content)
PageResponseImpl with the given content. This will result in the created PageResponse being identical to the entire List.content - must not be null.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.util.List<T> getContent()
getContent in interface PageResponse<T>List.public void setContent(java.util.List<T> content)
PageResponsesetContent in interface PageResponse<T>content - list of content/objects of this pagepublic int getNumber()
PageResponsePageResponse. Is always non-negative.getNumber in interface PageResponse<T>PageResponse.public int getNumberOfElements()
PageResponsePageResponse.getNumberOfElements in interface PageResponse<T>PageResponse.public PageRequest getPageRequest()
getPageRequest in interface PageResponse<T>public void setPageRequest(PageRequest pageRequest)
public int getSize()
PageResponsePageResponse.getSize in interface PageResponse<T>PageResponse.public Sorting getSorting()
getSorting in interface PageResponse<T>PageResponse.public long getTotalElements()
PageResponsegetTotalElements in interface PageResponse<T>public void setTotalElements(long totalElements)
public int getTotalPages()
PageResponsegetTotalPages in interface PageResponse<T>public boolean hasContent()
PageResponsePageResponse has content at all.hasContent in interface PageResponse<T>PageResponse has content at all.public boolean hasNext()
PageResponsePageResponse.hasNext in interface PageResponse<T>PageResponse.public boolean hasPrevious()
PageResponsePageResponse.hasPrevious in interface PageResponse<T>PageResponse.public int hashCode()
hashCode in class java.lang.Objectpublic boolean isFirst()
PageResponsePageResponse is the first one.isFirst in interface PageResponse<T>PageResponse is the first one.public boolean isLast()
PageResponsePageResponse is the last one.isLast in interface PageResponse<T>PageResponse is the last one.public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>public PageRequest nextPageRequest()
PageResponsePageRequest to request the next PageResponse. Can be null in case the current
PageResponse is already the last one. Clients should check PageResponse.hasNext() before calling this method to make
sure they receive a non-null value.nextPageRequest in interface PageResponse<T>PageRequest to request the next PageResponsepublic PageRequest previousPageRequest()
PageResponsePageRequest to request the previous PageResponse. Can be null in case the current
PageResponse is already the first one. Clients should check PageResponse.hasPrevious() before calling this method make
sure receive a non-null value.previousPageRequest in interface PageResponse<T>PageRequest to request the previous PageResponsepublic java.lang.String toString()
toString in class java.lang.ObjectCopyright © 2018. All rights reserved.