Class PagerBeanUtil

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

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

    Constructors 
    Constructor Description
    PagerBeanUtil()  
  • Method Summary

    Modifier and Type Method Description
    static void computeRecordIndexesAndPagesNumber​(PagerBean bean)
    static <E> java.util.List<E> getPage​(java.util.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
    static org.apache.commons.lang3.tuple.Pair<java.lang.Long,​java.lang.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
    static long getTotalPage​(long totalCount, int pageSize)
    Given a total count of elements and a page size, compute the number of pages available.
    static PagerBean newPagerBean()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • 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<java.lang.Long,​java.lang.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> java.util.List<E> getPage​(java.util.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()