public final class Page extends Object
This class basically defines a paged view of a database based on a given offset, limit, ordering, required criteria
and optional criteria. This is used by BaseEntityService.getPage(Page, boolean) methods.
BaseEntityService,
Criteria| Modifier and Type | Class and Description |
|---|---|
static class |
Page.Builder
The page builder.
|
| Constructor and Description |
|---|
Page(Integer offset,
Integer limit,
Identifiable<?> last,
Boolean reversed,
LinkedHashMap<String,Boolean> ordering,
Map<String,Object> requiredCriteria,
Map<String,Object> optionalCriteria)
Creates a new Page whereby value based paging will be performed instead of offset based paging when applicable.
|
Page(Integer offset,
Integer limit,
LinkedHashMap<String,Boolean> ordering,
Map<String,Object> requiredCriteria,
Map<String,Object> optionalCriteria)
Creates a new Page.
|
| Modifier and Type | Method and Description |
|---|---|
Page |
all()
Returns a clone of the current page which returns all results matching the current ordering, required criteria and optional criteria.
|
boolean |
equals(Object object) |
Identifiable<?> |
getLast()
Returns the last entity of the previous page, if any.
|
int |
getLimit()
Returns the limit.
|
int |
getOffset()
Returns the offset.
|
Map<String,Object> |
getOptionalCriteria()
Returns the optional criteria.
|
Map<String,Boolean> |
getOrdering()
Returns the ordering.
|
Map<String,Object> |
getRequiredCriteria()
Returns the required criteria.
|
int |
hashCode() |
boolean |
isReversed()
Returns whether the value based paging is reversed.
|
static Page |
of(int offset,
int limit)
Use this if you want a page of given offset and limit.
|
String |
toString() |
static Page.Builder |
with()
Use this if you want to build a new page.
|
public Page(Integer offset, Integer limit, LinkedHashMap<String,Boolean> ordering, Map<String,Object> requiredCriteria, Map<String,Object> optionalCriteria)
of(int, int) or the with() builder.offset - Zero-based offset of the page. May not be negative. Defaults to 0.limit - Maximum amount of records to be matched. May not be less than 1. Defaults to Integer.MAX_VALUE.ordering - Ordering of results. Map key represents property name and map value represents whether to sort ascending. Defaults to {"id",false}.requiredCriteria - Required criteria. Map key represents property name and map value represents criteria. Each entity must match all of given criteria.optionalCriteria - Optional criteria. Map key represents property name and map value represents criteria. Each entity must match at least one of given criteria.public Page(Integer offset, Integer limit, Identifiable<?> last, Boolean reversed, LinkedHashMap<String,Boolean> ordering, Map<String,Object> requiredCriteria, Map<String,Object> optionalCriteria)
offset - Zero-based offset of the page. May not be negative. Defaults to 0.limit - Maximum amount of records to be matched. May not be less than 1. Defaults to Integer.MAX_VALUE.last - Last entity of the previous page. When not null, then value based paging will be performed instead of offset based paging when applicable.reversed - Whether value based paging is reversed. This is ignored when last entity is null. Defaults to false.ordering - Ordering of results. Map key represents property name and map value represents whether to sort ascending. Defaults to {"id",false}.requiredCriteria - Required criteria. Map key represents property name and map value represents criteria. Each entity must match all of given criteria.optionalCriteria - Optional criteria. Map key represents property name and map value represents criteria. Each entity must match at least one of given criteria.public int getOffset()
public int getLimit()
Integer.MAX_VALUE.public Identifiable<?> getLast()
null, then value based paging will be performed instead of offset based paging when applicable.public boolean isReversed()
getLast() is not null.public Map<String,Boolean> getOrdering()
{"id",false}.public Map<String,Object> getRequiredCriteria()
public Map<String,Object> getOptionalCriteria()
public Page all()
public static Page.Builder with()
public static Page of(int offset, int limit)
offset - Zero-based offset of the page. May not be negative. Defaults to 0.limit - Maximum amount of records to be matched. May not be less than 1. Defaults to Integer.MAX_VALUE.Copyright © 2015–2020 OmniFaces. All rights reserved.