Package ch.ivyteam.ivy.persistence.query
Interface IPagedResult<V>
-
- All Superinterfaces:
IPagedIterable<V>
,Iterable<V>
public interface IPagedResult<V> extends IPagedIterable<V>
Iterate, stream or read results in pages. Only the results in one page are loaded to the memory at once so that large data sets can be handled.
You can use it in for each loops:
for (V result : query.executor().resultsPaged()) { System.out.println(result); }
You can use it to display the results in paged table on the UI:
public class MyLazyDataModel extends LazyDataModel<Car> { @ Override public List<Car> load(int first, int pageSize, Map<String, SortMeta> sortMeta, Map<String, FilterMeta> filterMeta) { return query.executor().resultsPaged().window(first, pageSize); } }
- Since:
- 8.0.3
- API:
- This is a public API.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
count()
List<V>
page(int page)
long
pages()
int
pageSize()
List<V>
window(int startIndex, int pageSize)
Gets the objects in a certain page window.-
Methods inherited from interface ch.ivyteam.ivy.persistence.query.IPagedIterable
stream
-
-
-
-
Method Detail
-
pageSize
int pageSize()
- Returns:
- the size of page 1..n
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
pages
long pages()
- Returns:
- the number of pages in the whole data set
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
page
List<V> page(int page)
- Parameters:
page
- the page number 1..n- Returns:
- the objects that are in the given page. Never null. Maybe empty if page does not exists
- See Also:
window(int, int)
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
window
List<V> window(int startIndex, int pageSize)
Gets the objects in a certain page window.
Note that the startIndex is zero based. To get the second page the startIndex has to be increased with the pageSize.
- Parameters:
startIndex
- the index of the first object to return 0..n. For the second page increase startIndex with pageSizepageSize
- the number of objects to return 1..n- Returns:
- the objects that are in the given page window. Never null. Maybe empty if page does not exists
- See Also:
page(int)
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
count
long count()
- Returns:
- total number of objects
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-