Class PageRequestImpl

java.lang.Object
de.digitalcollections.model.impl.paging.PageRequestImpl
All Implemented Interfaces:
PageRequest, java.io.Serializable
Direct Known Subclasses:
SearchPageRequestImpl

public class PageRequestImpl
extends java.lang.Object
implements PageRequest, java.io.Serializable
Basic Java Bean implementation of PageRequest. See Spring Data Commons, but more flat design and independent of Spring libraries.
See Also:
Serialized Form
  • Constructor Details

    • PageRequestImpl

      public PageRequestImpl()
    • PageRequestImpl

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

      public PageRequestImpl​(int pageNumber, int pageSize, Direction direction, java.lang.String... properties)
      Creates a new PageRequest with sort parameters applied.
      Parameters:
      pageNumber - zero-based page index.
      pageSize - 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 pageNumber, int pageSize, Sorting sort)
    • PageRequestImpl

      public PageRequestImpl​(int pageNumber, int pageSize, Sorting sort, Filtering filtering)
      Creates a new PageRequest with sort parameters applied.
      Parameters:
      pageNumber - zero-based page index, must not be less than zero.
      pageSize - the size of the page to be returned, must not be less than one.
      sort - can be null
      filtering - contains list of filter criterias
  • Method Details

    • equals

      public boolean equals​(java.lang.Object obj)
      Overrides:
      equals in class java.lang.Object
    • first

      public PageRequest first()
      Specified by:
      first in interface PageRequest
      Returns:
      the PageRequest requesting the first page
    • getFiltering

      public Filtering getFiltering()
      Specified by:
      getFiltering in interface PageRequest
      Returns:
      the filtering parameters
    • getOffset

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

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

      public int getPageSize()
      Specified by:
      getPageSize in interface PageRequest
      Returns:
      the number of items of that page
    • getSorting

      public Sorting getSorting()
      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 java.lang.Object
    • next

      public PageRequest next()
      Specified by:
      next in interface PageRequest
      Returns:
      the PageRequest requesting the next page
    • previous

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

      public PageRequest previousOrFirst()
      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 pageNumber)
      Specified by:
      setPageNumber in interface PageRequest
      Parameters:
      pageNumber - the page to be returned
    • setPageSize

      public void setPageSize​(int pageSize)
      Specified by:
      setPageSize in interface PageRequest
      Parameters:
      pageSize - the number of items of that page
    • setSorting

      public void setSorting​(Sorting sort)
      Specified by:
      setSorting in interface PageRequest
      Parameters:
      sort - the sorting parameters
    • setFiltering

      public void setFiltering​(Filtering filtering)
      Specified by:
      setFiltering in interface PageRequest
      Parameters:
      filtering - the filtering criterias
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object