Class PageRequestImpl

    • Constructor Detail

      • PageRequestImpl

        public PageRequestImpl()
      • PageRequestImpl

        public PageRequestImpl​(int page,
                               int size)
        Creates a new PageRequest. Pages are zero indexed, thus providing 0 for page will return the first page.
        Parameters:
        page - zero-based page index.
        size - the size of the page to be returned.
      • PageRequestImpl

        public PageRequestImpl​(int page,
                               int size,
                               Direction direction,
                               String... properties)
        Creates a new PageRequest with sort parameters applied.
        Parameters:
        page - zero-based page index.
        size - the size of the page to be returned.
        direction - the direction of the SortingImpl to be specified, can be null.
        properties - the properties to sort by, must not be null or empty.
      • PageRequestImpl

        public PageRequestImpl​(int page,
                               int size,
                               Sorting sort)
        Creates a new PageRequest with sort parameters applied.
        Parameters:
        page - zero-based page index, must not be less than zero.
        size - the size of the page to be returned, must not be less than one.
        sort - can be null.
    • Method Detail

      • getOffset

        public int getOffset()
        Description copied from interface: PageRequest
        Returns the offset to be taken according to the underlying page and page size.
        Specified by:
        getOffset in interface PageRequest
        Returns:
        the offset to be taken
      • getPageNumber

        public int getPageNumber()
        Description copied from interface: PageRequest
        Returns the page to be returned.
        Specified by:
        getPageNumber in interface PageRequest
        Returns:
        the page to be returned.
      • getPageSize

        public int getPageSize()
        Description copied from interface: PageRequest
        Returns the number of items to be returned.
        Specified by:
        getPageSize in interface PageRequest
        Returns:
        the number of items of that page
      • getSorting

        public Sorting getSorting()
        Description copied from interface: PageRequest
        Returns the sorting parameters.
        Specified by:
        getSorting in interface PageRequest
        Returns:
        the sorting parameters
      • hasPrevious

        public boolean hasPrevious()
        Description copied from interface: PageRequest
        Returns whether there's a previous PageRequest we can access from the current one. Will return false in case the current PageRequest already refers to the first page.
        Specified by:
        hasPrevious in interface PageRequest
        Returns:
        whether there's a previous PageRequest
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • previous

        public PageRequest previous()
        Returns the PageResponse requesting the previous page.
        Returns:
        the PageResponse requesting the previous page
      • previousOrFirst

        public PageRequest previousOrFirst()
        Description copied from interface: PageRequest
        Returns the previous PageRequest or the first PageRequest if the current one already is the first one.
        Specified by:
        previousOrFirst in interface PageRequest
        Returns:
        the previous PageRequest or the first PageRequest if the current one already is the first one
      • setPageNumber

        public void setPageNumber​(int page)
      • setPageSize

        public void setPageSize​(int size)
        Description copied from interface: PageRequest
        Sets the number of items.
        Specified by:
        setPageSize in interface PageRequest
        Parameters:
        size - the number of items of that page
      • setSorting

        public void setSorting​(Sorting sort)
        Description copied from interface: PageRequest
        Sets the sorting parameters.
        Specified by:
        setSorting in interface PageRequest
        Parameters:
        sort - the sorting parameters