Package org.javalite.activejdbc
Class Paginator.PaginatorBuilder<T extends Model>
- java.lang.Object
-
- org.javalite.activejdbc.Paginator.PaginatorBuilder<T>
-
-
Constructor Summary
Constructors Constructor Description PaginatorBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Paginator.PaginatorBuilder<T>countQuery(String countQuery)Part of the query that is responsible for count.Paginator<T>create()Terminal method to create an instance of Paginator.Paginator.PaginatorBuilder<T>currentPageIndex(int currentPageIndex, boolean skipCheck)Paginator.PaginatorBuilder<T>modelClass(Class<T> modelClass)Model class mapped to a table.>Paginator.PaginatorBuilder<T>orderBy(String orderBys)Paginator.PaginatorBuilder<T>pageSize(int pageSize)Page size - number of items in a pagePaginator.PaginatorBuilder<T>params(Object... params)Array of parameters in case a query is parametrizedPaginator.PaginatorBuilder<T>query(String query)Paginator.PaginatorBuilder<T>suppressCounts(boolean suppressCounts)Suppress calling "select count(*)...
-
-
-
Method Detail
-
modelClass
public Paginator.PaginatorBuilder<T> modelClass(Class<T> modelClass)
Model class mapped to a table.>- Parameters:
modelClass- Model class mapped to a table.>- Returns:
- self
-
pageSize
public Paginator.PaginatorBuilder<T> pageSize(int pageSize)
Page size - number of items in a page- Parameters:
pageSize- Page size - number of items in a page
-
orderBy
public Paginator.PaginatorBuilder<T> orderBy(String orderBys)
- Parameters:
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 timePaginator.getCount()is called fromPaginator.hasNext()as well.- Parameters:
suppressCounts- suppress counts every time.
-
query
public Paginator.PaginatorBuilder<T> query(String query)
- Parameters:
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(u.id). Only use this method if you need something more complex thanCOUNT(*), since that is the value that us used by default.- Parameters:
countQuery- Part of the query that is responsible for "count. Example:count(*)" orCOUNT(DISTINCT(u.id).
-
params
public Paginator.PaginatorBuilder<T> params(Object... params)
Array of parameters in case a query is parametrized- Parameters:
params- Array of parameters in case a query is parametrized
-
currentPageIndex
public Paginator.PaginatorBuilder<T> currentPageIndex(int currentPageIndex, boolean skipCheck)
-
-