Package mil.nga.geopackage.db
Class Pagination
- java.lang.Object
-
- mil.nga.geopackage.db.Pagination
-
public class Pagination extends Object
Query pagination configuration- Since:
- 6.2.0
- Author:
- osbornb
-
-
Constructor Summary
Constructors Constructor Description Pagination(int limit)
ConstructorPagination(int limit, long offset)
ConstructorPagination(int limit, Long offset)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Pagination
find(String sql)
Find the pagination offset and limit from the SQL statementint
getLimit()
Get the limitLong
getOffset()
Get the offsetboolean
hasLimit()
Is there positive limitboolean
hasOffset()
Is there an offsetvoid
incrementOffset()
If the limit is positive, increment the offsetvoid
incrementOffset(long count)
Increment the offset by the countString
replace(String sql)
Replace the limit and offset in the SQL statement with the pagination valuesstatic String
replace(Pagination pagination, String sql)
Replace the pagination limit and offset in the SQL statementvoid
setLimit(int limit)
Set the limitvoid
setOffset(Long offset)
Set the offsetString
toString()
-
-
-
Constructor Detail
-
Pagination
public Pagination(int limit)
Constructor- Parameters:
limit
- upper bound number of rows
-
Pagination
public Pagination(int limit, long offset)
Constructor- Parameters:
limit
- upper bound number of rowsoffset
- row result starting offset
-
Pagination
public Pagination(int limit, Long offset)
Constructor- Parameters:
limit
- upper bound number of rowsoffset
- row result starting offset
-
-
Method Detail
-
find
public static Pagination find(String sql)
Find the pagination offset and limit from the SQL statement- Parameters:
sql
- SQL statement- Returns:
- pagination or null if not found
-
replace
public static String replace(Pagination pagination, String sql)
Replace the pagination limit and offset in the SQL statement- Parameters:
pagination
- pagination settingssql
- SQL statement- Returns:
- modified SQL statement
-
getLimit
public int getLimit()
Get the limit- Returns:
- upper bound number of rows
-
setLimit
public void setLimit(int limit)
Set the limit- Parameters:
limit
- upper bound number of rows
-
hasLimit
public boolean hasLimit()
Is there positive limit- Returns:
- true if limit above 0
-
getOffset
public Long getOffset()
Get the offset- Returns:
- row result starting offset
-
hasOffset
public boolean hasOffset()
Is there an offset- Returns:
- true if has an offset
-
setOffset
public void setOffset(Long offset)
Set the offset- Parameters:
offset
- row result starting offset
-
incrementOffset
public void incrementOffset()
If the limit is positive, increment the offset
-
incrementOffset
public void incrementOffset(long count)
Increment the offset by the count- Parameters:
count
- count to increment
-
replace
public String replace(String sql)
Replace the limit and offset in the SQL statement with the pagination values- Parameters:
sql
- SQL statement- Returns:
- modified SQL statement
-
-