Class PagerBeanUtil

java.lang.Object
org.nuiton.topia.persistence.util.PagerBeanUtil

public class PagerBeanUtil extends Object
Useful method around PagerBean. Copied from nuiton-utils-3.0, removed since then.
  • Constructor Details

    • PagerBeanUtil

      public PagerBeanUtil()
  • Method Details

    • getTotalPage

      public static long getTotalPage(long totalCount, int pageSize)
      Given a total count of elements and a page size, compute the number of pages available.
      Parameters:
      totalCount - total count of elements in the pager
      pageSize - size of a page
      Returns:
      the number of available pages
    • getPageBound

      public static org.apache.commons.lang3.tuple.Pair<Long,Long> getPageBound(long totalCount, int page, int pageSize)
      Compute the pager bound given his datas:
      • totalCount: count of all elements of the pager
      • pageSize: number of elements in a page
      • page: the requested page number starting at 1
      Parameters:
      totalCount - total count of elements in the pager
      page - pager page number (starting at 1)
      pageSize - number of elements in a page
      Returns:
      the bound of start and end index of the requested elements of the pager
    • getPage

      public static <E> List<E> getPage(List<E> elements, int page, int pageSize)
      Get the elements of the lists using the pager datas:
      • elements:all elements of the pager
      • pageSize: number of elements in a page
      • page: the requested page number starting at 1
      Type Parameters:
      E - n'importe quel type
      Parameters:
      elements - all pager elements
      page - pager page number (starting at 1)
      pageSize - number of elements in a page
      Returns:
      la liste une fois filtrée
    • computeRecordIndexesAndPagesNumber

      public static void computeRecordIndexesAndPagesNumber(PagerBean bean)
      Parameters:
      bean - the pagerBean to fill
      Since:
      2.4.3
    • newPagerBean

      public static PagerBean newPagerBean()