Interface Page<T>

  • All Superinterfaces:
    Slice<T>
    All Known Implementing Classes:
    PageImpl

    public interface Page<T>
    extends Slice<T>
    An extension of a Slice in which is known the overall amount of data.
    • Method Detail

      • totalPages

        int totalPages()
        Returns:
        The total amount of pages.
      • totalElements

        long totalElements()
        Returns:
        The overall amount of elements.
      • map

        <U> Page<U> map​(java.util.function.Function<T,​U> mapper)
        Maps the content of this page according to the given mapper.
        Specified by:
        map in interface Slice<T>
        Type Parameters:
        U - Concrete type of the resulting contents.
        Parameters:
        mapper - A Function that maps the contents of this page.
        Returns:
        A new page containing the mapped elements.
      • empty

        static <S> Page<S> empty()
        Creates an empty Page.
        Type Parameters:
        S - The type of elements in the page.
        Returns:
        An empty Page.
      • emptyUnsorted

        static <S> Page<S> emptyUnsorted​(int number,
                                         int size,
                                         long totalElements)
        Creates an empty unsorted Page, using the given paging information.
        Type Parameters:
        S - The type of elements in the page.
        Parameters:
        number - The number of the page.
        size - The size of the page.
        totalElements - The overall amount of elements.
        Returns:
        An unsorted empty Page.
      • empty

        static <S> Page<S> empty​(int number,
                                 int size,
                                 SortingData sortingData,
                                 long totalElements)
        Creates an empty Page, using the given paging and sorting information.
        Type Parameters:
        S - The type of elements in the page.
        Parameters:
        number - The number of the page.
        size - The size of the page.
        sortingData - The SortingData that was used to sort contents of this page.
        totalElements - The overall amount of elements.
        Returns:
        An empty Page.
      • ofUnsorted

        static <S> Page<S> ofUnsorted​(int number,
                                      int size,
                                      java.util.List<S> content,
                                      long totalElements)
        Creates an unsorted Page.
        Type Parameters:
        S - The type of elements in the page.
        Parameters:
        number - The number of the page.
        size - The size of the page.
        content - The elements in the page.
        totalElements - The overall amount of elements.
        Returns:
        An unsorted Page.
      • of

        static <S> Page<S> of​(int number,
                              int size,
                              SortingData sortingData,
                              java.util.List<S> content,
                              long totalElements)
        Creates a Page.
        Type Parameters:
        S - The type of elements in the page.
        Parameters:
        number - The number of the page.
        size - The size of the page.
        sortingData - The SortingData that was used to sort contents of this page.
        content - The elements in the page.
        totalElements - The overall amount of elements.
        Returns:
        A Page.