Interface PageResponse<T>

Type Parameters:
T - object type listed in page
All Superinterfaces:
java.lang.Iterable<T>
All Known Subinterfaces:
SearchPageResponse<T>
All Known Implementing Classes:
PageResponseImpl, SearchPageResponseImpl

public interface PageResponse<T>
extends java.lang.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 Details

    • getContent

      java.util.List<T> getContent()
      Returns:
      the page content/objects as List.
    • setContent

      void setContent​(java.util.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 current PageResponse. Is always non-negative.
      Returns:
      the number of the current PageResponse.
    • getNumberOfElements

      int getNumberOfElements()
      Returns the number of elements currently on this PageResponse.
      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 the PageResponse.
      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 the PageResponse has content at all.
      Returns:
      whether the PageResponse has content at all.
    • hasNext

      boolean hasNext()
      Returns if there is a next PageResponse.
      Returns:
      if there is a next PageResponse.
    • hasPrevious

      boolean hasPrevious()
      Returns if there is a previous PageResponse.
      Returns:
      if there is a previous PageResponse.
    • isFirst

      boolean isFirst()
      Returns whether the current PageResponse is the first one.
      Returns:
      whether the current PageResponse is the first one.
    • isLast

      boolean isLast()
      Returns whether the current PageResponse is the last one.
      Returns:
      whether the current PageResponse is the last one.
    • nextPageRequest

      PageRequest nextPageRequest()
      Returns the PageRequest to request the next PageResponse. Can be null in case the current PageResponse is already the last one. Clients should check hasNext() before calling this method to make sure they receive a non-null value.
      Returns:
      the PageRequest to request the next PageResponse
    • previousPageRequest

      PageRequest previousPageRequest()
      Returns the PageRequest to request the previous PageResponse. Can be null in case the current PageResponse is already the first one. Clients should check hasPrevious() before calling this method make sure receive a non-null value.
      Returns:
      the PageRequest to request the previous PageResponse