public class PaginationParameter extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
PaginationParameter.PaginationParameterBuilder
Class used to build an instance of PaginationParameter.
|
Modifier and Type | Field and Description |
---|---|
static PaginationParameter |
ALL
An instance that represents a page of ALL elements
|
protected static int |
ALL_PAGE_SIZE
All results.
|
protected List<PaginationOrder> |
orderClauses
The list of order clauses.
|
protected int |
pageNumber
0-based page number
|
protected int |
pageSize
The size of each page.
|
Modifier | Constructor and Description |
---|---|
protected |
PaginationParameter(int pageNumber,
int pageSize) |
protected |
PaginationParameter(int pageNumber,
int pageSize,
List<PaginationOrder> orderClauses) |
Modifier and Type | Method and Description |
---|---|
static PaginationParameter.PaginationParameterBuilder |
builder(int pageNumber,
int pageSize)
Method to create a PaginationParameter using the
PaginationParameter.PaginationParameterBuilder . |
boolean |
equals(Object o) |
int |
getEndIndex()
Method that computes the end index of a page according to
pageNumber and pageSize . |
List<PaginationOrder> |
getOrderClauses() |
int |
getPageNumber() |
int |
getPageSize() |
int |
getStartIndex()
Method that computes the start index of a page according to
pageNumber and pageSize . |
int |
hashCode() |
boolean |
isAll()
Test if pagination parameter is about all results range.
|
static PaginationParameter |
of(int pageNumber,
int pageSize)
Method to create a PaginationParameter only based on pageNumber and pageSize (no order clauses).
|
static PaginationParameter |
of(int pageNumber,
int pageSize,
String orderClause1,
boolean orderDesc1)
Method to create a PaginationParameter based on pageNumber, pageSize and a single order clause.
|
static PaginationParameter |
of(int pageNumber,
int pageSize,
String orderClause1,
boolean orderDesc1,
String orderClause2,
boolean orderDesc2)
Method to create a PaginationParameter based on pageNumber, pageSize and two order clauses.
|
static PaginationParameter |
of(int pageNumber,
int pageSize,
String orderClause1,
boolean orderDesc1,
String orderClause2,
boolean orderDesc2,
String orderClause3,
boolean orderDesc3)
Method to create a PaginationParameter based on pageNumber, pageSize and three order clauses.
|
protected static final int ALL_PAGE_SIZE
public static final PaginationParameter ALL
protected int pageNumber
protected int pageSize
protected List<PaginationOrder> orderClauses
protected PaginationParameter(int pageNumber, int pageSize)
protected PaginationParameter(int pageNumber, int pageSize, List<PaginationOrder> orderClauses)
public static PaginationParameter of(int pageNumber, int pageSize)
pageNumber
- the index (0-based) of the pagepageSize
- the size of each page. Value can be -1 (for infinite pageSize) or greater than 0public static PaginationParameter of(int pageNumber, int pageSize, String orderClause1, boolean orderDesc1)
builder(int, int)
method together with PaginationParameter.PaginationParameterBuilder.addOrder(String, boolean)
and
PaginationParameter.PaginationParameterBuilder.build()
methods.pageNumber
- the index (0-based) of the pagepageSize
- the size of each page. Value can be -1 (for infinite pageSize) or greater than 0orderClause1
- an order clause attribute name. It comes together with {code}orderDesc1{/code}orderDesc1
- the asc/desc property associated with {code}orderClause1{/code}PaginationOrder
,
PaginationParameter.PaginationParameterBuilder
public static PaginationParameter of(int pageNumber, int pageSize, String orderClause1, boolean orderDesc1, String orderClause2, boolean orderDesc2)
builder(int, int)
method together with PaginationParameter.PaginationParameterBuilder.addOrder(String, boolean)
and
PaginationParameter.PaginationParameterBuilder.build()
methods.pageNumber
- the index (0-based) of the pagepageSize
- the size of each page. Value can be -1 (for infinite pageSize) or greater than 0orderClause1
- an order clause attribute name. It comes together with {code}orderDesc1{/code}orderDesc1
- the asc/desc property associated with {code}orderClause1{/code}orderClause2
- an order clause attribute name. It comes together with {code}orderDesc2{/code}orderDesc2
- the asc/desc property associated with {code}orderClause2{/code}PaginationOrder
,
PaginationParameter.PaginationParameterBuilder
public static PaginationParameter of(int pageNumber, int pageSize, String orderClause1, boolean orderDesc1, String orderClause2, boolean orderDesc2, String orderClause3, boolean orderDesc3)
builder(int, int)
method together with PaginationParameter.PaginationParameterBuilder.addOrder(String, boolean)
and
PaginationParameter.PaginationParameterBuilder.build()
methods.pageNumber
- the index (0-based) of the pagepageSize
- the size of each page. Value can be -1 (for infinite pageSize) or greater than 0orderClause1
- an order clause attribute name. It comes together with {code}orderDesc1{/code}orderDesc1
- the asc/desc property associated with {code}orderClause1{/code}orderClause2
- an order clause attribute name. It comes together with {code}orderDesc2{/code}orderDesc2
- the asc/desc property associated with {code}orderClause2{/code}orderClause3
- an order clause attribute name. It comes together with {code}orderDesc3{/code}orderDesc3
- the asc/desc property associated with {code}orderClause3{/code}PaginationOrder
,
PaginationParameter.PaginationParameterBuilder
public static PaginationParameter.PaginationParameterBuilder builder(int pageNumber, int pageSize)
PaginationParameter.PaginationParameterBuilder
.pageNumber
- the index (0-based) of the pagepageSize
- the size of each page. Value can be -1 (for infinite pageSize) or greater than 0public int getPageNumber()
public int getPageSize()
public List<PaginationOrder> getOrderClauses()
public int getStartIndex()
pageNumber
and pageSize
.public int getEndIndex()
pageNumber
and pageSize
. If the
pageSize is -1, the end index will be Integer.MAX_VALUE
.public boolean isAll()
true
if pagination parameter is about all results rangeCopyright © 2004–2020 CodeLutin. All rights reserved.