Class PageRequest

    • Constructor Detail

      • PageRequest

        public PageRequest​(int page,
                           int pageSize)
        Creates a new PageRequest for requesting the given page with the given page size.
        Parameters:
        page - The zero based page number
        pageSize - The number of elements per page
      • PageRequest

        public PageRequest​(int page,
                           int pageSize,
                           Sort.Direction direction,
                           String... paths)
        Creates a new PageRequest with a sorting based on the given paths and direction.
        Parameters:
        page - The zero based page number
        pageSize - The number of elements per page
        direction - The direction to use for the Sort to be specified, may be null
        paths - The paths to sort by
      • PageRequest

        public PageRequest​(int page,
                           int pageSize,
                           Sort sort)
        Creates a new PageRequest with given sorting.
        Parameters:
        page - The zero based page number
        pageSize - The number of elements per page
        sort - The sorting to use for the page, may be null
      • PageRequest

        public PageRequest​(Sort sort,
                           int offset,
                           int pageSize)
        Creates a new PageRequest with given sorting.
        Parameters:
        sort - The sorting to use for the page, may be null
        offset - The zero based offset number
        pageSize - The number of elements per page
        Since:
        1.3.0
    • Method Detail

      • getSort

        public Sort getSort()
        Description copied from interface: Pageable
        Returns the sorting that should be used for pagination.
        Specified by:
        getSort in interface Pageable
        Returns:
        The sorting
      • getPageSize

        public int getPageSize()
        Description copied from interface: Pageable
        Returns the number of elements per page to be returned.
        Specified by:
        getPageSize in interface Pageable
        Returns:
        The number of elements per page
      • getPageNumber

        public int getPageNumber()
        Description copied from interface: Pageable
        Returns the page to be returned. Zero based.
        Specified by:
        getPageNumber in interface Pageable
        Returns:
        The page to be returned.
      • getOffset

        public int getOffset()
        Description copied from interface: Pageable
        Returns the offset represented by the page number multiplied with the page size.
        Specified by:
        getOffset in interface Pageable
        Returns:
        The offset
      • hasPrevious

        public boolean hasPrevious()
        Description copied from interface: Pageable
        Returns whether there is a previous Pageable i.e. if the page number is greater than 0.
        Specified by:
        hasPrevious in interface Pageable
        Returns:
        Whether there is a previous page
      • previous

        public Pageable previous()
        Description copied from interface: Pageable
        Returns the Pageable that can be used to request the previous Page or null if the current one already is the first one.
        Specified by:
        previous in interface Pageable
        Returns:
        The Pageable for the previous Page
      • previousOrFirst

        public Pageable previousOrFirst()
        Description copied from interface: Pageable
        Returns the Pageable that can be used to request the previous Page or the first if the current one already is the first one.
        Specified by:
        previousOrFirst in interface Pageable
        Returns:
        The Pageable for the previous or first Page
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object