Class Page.Builder
- java.lang.Object
-
- org.omnifaces.persistence.model.dto.Page.Builder
-
- Enclosing class:
- Page
public static class Page.Builder extends Object
The page builder. UsePage.with()to get started.- Author:
- Bauke Scholtz
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Page.BuilderallMatch(Map<String,Object> requiredCriteria)Set the required criteria.Page.BuilderanyMatch(Map<String,Object> optionalCriteria)Set the optional criteria.Pagebuild()Build the page.Page.BuilderorderBy(String field, boolean ascending)Set the ordering.Page.Builderrange(int offset, int limit)Set the range.
-
-
-
Method Detail
-
range
public Page.Builder range(int offset, int limit)
Set the range.- Parameters:
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 toInteger.MAX_VALUE.- Returns:
- This builder.
- Throws:
IllegalStateException- When another offset and limit is already set in this builder.
-
orderBy
public Page.Builder orderBy(String field, boolean ascending)
Set the ordering. This can be invoked multiple times and will be remembered in same order. The default ordering is{"id",false}.- Parameters:
field- The field.ascending- Whether to sort ascending.- Returns:
- This builder.
-
allMatch
public Page.Builder allMatch(Map<String,Object> requiredCriteria)
Set the required criteria. Map key represents property path and map value represents criteria. Each entity must match all of given criteria.- Parameters:
requiredCriteria- Required criteria.- Returns:
- This builder.
- Throws:
IllegalStateException- When another required criteria is already set in this builder.- See Also:
Criteria
-
anyMatch
public Page.Builder anyMatch(Map<String,Object> optionalCriteria)
Set the optional criteria. Map key represents property path and map value represents criteria. Each entity must match at least one of given criteria.- Parameters:
optionalCriteria- Optional criteria.- Returns:
- This builder.
- Throws:
IllegalStateException- When another optional criteria is already set in this builder.- See Also:
Criteria
-
build
public Page build()
Build the page.- Returns:
- The built page.
-
-