Class Paginator.PaginatorBuilder<T extends Model>

Enclosing class:
Paginator<T extends Model>

public static class Paginator.PaginatorBuilder<T extends Model> extends Object
Provides a builder pattern to create new instances of paginator.
  • Constructor Details

    • PaginatorBuilder

      public PaginatorBuilder()
  • Method Details

    • modelClass

      public Paginator.PaginatorBuilder<T> modelClass(Class<T> modelClass)
      Model class mapped to a table.>
      modelClass - Model class mapped to a table.>
    • pageSize

      public Paginator.PaginatorBuilder<T> pageSize(int pageSize)
      Page size - number of items in a page
      pageSize - Page size - number of items in a page
    • orderBy

      public Paginator.PaginatorBuilder<T> orderBy(String orderBys)
      orderBys - a comma-separated list of field names followed by either "desc" or "asc"
    • suppressCounts

      public Paginator.PaginatorBuilder<T> suppressCounts(boolean suppressCounts)
      Suppress calling "select count(*)... " on a table each time. If set to true, it will call count only once. If set to false, it will call count each time Paginator.getCount() is called from Paginator.hasNext() as well.
      suppressCounts - suppress counts every time.
    • query

      public Paginator.PaginatorBuilder<T> query(String query)
      query - Query that will be applied every time a new page is requested; this query should not contain limit, offset or order by clauses of any kind, Paginator will do this automatically. This parameter can have two forms, a sub-query or a full query.
    • countQuery

      public Paginator.PaginatorBuilder<T> countQuery(String countQuery)
      Part of the query that is responsible for count. Example: COUNT(DISTINCT( Only use this method if you need something more complex than COUNT(*), since that is the value that us used by default.
      countQuery - Part of the query that is responsible for "count. Example: count(*)" or COUNT(DISTINCT(
    • params

      public Paginator.PaginatorBuilder<T> params(Object... params)
      Array of parameters in case a query is parametrized
      params - Array of parameters in case a query is parametrized
    • currentPageIndex

      public Paginator.PaginatorBuilder<T> currentPageIndex(int currentPageIndex, boolean skipCheck)
      See Also:
      Paginator.setCurrentPageIndex(int, boolean)
    • create

      public Paginator<T> create()
      Terminal method to create an instance of Paginator.
      new Paginator properly configured.