Class PaginationCriterion


  • public class PaginationCriterion
    extends Object
    A pagination criterion. This criterion is aimed to a query for persisted entities in order to limit the number of return of such entities.
    Author:
    mmoquillon
    • Field Detail

      • NO_PAGINATION

        public static final PaginationCriterion NO_PAGINATION
        This instance represents no pagination. It is the equivalent of the null value but in a better typed way.
    • Constructor Detail

      • PaginationCriterion

        public PaginationCriterion​(int page,
                                   int count)
        Constructs a new pagination criterion from the specified page number and count of items this page has to gather.
        Parameters:
        page - the page number. It identifies in a pagination the page of items.
        count - the number of items to return within the page.
    • Method Detail

      • setOriginalSizeRequired

        public PaginationCriterion setOriginalSizeRequired​(boolean originalSizeRequired)
        Indicates if the original size of rresult mus be computed or not.
        Parameters:
        originalSizeRequired - true to compute, false otherwise.
        Returns:
        itself.
      • getPageNumber

        public int getPageNumber()
        The page number.
        Returns:
        a positive integer identifying the page of items to return.
      • getItemCount

        public int getItemCount()
        The maximum number of items the page has to contain.
        Returns:
        the maximum number of items to return.
      • isOriginalSizeNeeded

        public boolean isOriginalSizeNeeded()
        Is the original result size required?
        Returns:
        true if required, false otherwise.
      • isDefined

        public boolean isDefined()
        Is this pagination criterion defined.
        Returns:
        true if this pagination criterion isn't the NO_PAGINATION instance.