Constructor and Description |
---|
PaginatorBuilder() |
Modifier and Type | Method and 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 page
|
Paginator.PaginatorBuilder<T> |
params(Object... params)
Array of parameters in case a query is parametrized
|
Paginator.PaginatorBuilder<T> |
query(String query) |
Paginator.PaginatorBuilder<T> |
suppressCounts(boolean suppressCounts)
Suppress calling "select count(*)...
|
public Paginator.PaginatorBuilder<T> modelClass(Class<T> modelClass)
modelClass
- Model class mapped to a table.>public Paginator.PaginatorBuilder<T> pageSize(int pageSize)
pageSize
- Page size - number of items in a pagepublic Paginator.PaginatorBuilder<T> orderBy(String orderBys)
orderBys
- a comma-separated list of field names followed by either "desc" or "asc"public Paginator.PaginatorBuilder<T> suppressCounts(boolean suppressCounts)
Paginator.getCount()
is called from Paginator.hasNext()
as well.suppressCounts
- suppress counts every time.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.public Paginator.PaginatorBuilder<T> countQuery(String countQuery)
COUNT(DISTINCT(u.id)
.
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(u.id)
.public Paginator.PaginatorBuilder<T> params(Object... params)
params
- Array of parameters in case a query is parametrizedpublic Paginator.PaginatorBuilder<T> currentPageIndex(int currentPageIndex, boolean skipCheck)
Copyright © 2019 JavaLite. All rights reserved.