Package de.xima.fc.mdl.data
Class PagedResult<TEntity extends Serializable>
- java.lang.Object
-
- de.xima.fc.mdl.data.PagedResult<TEntity>
-
- Type Parameters:
TEntity
- type of object to get a paged result for.
- All Implemented Interfaces:
Serializable
public final class PagedResult<TEntity extends Serializable> extends Object implements Serializable
Model representing the result for a paged query.- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PagedResult(List<TEntity> result, int resultCount)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <TEntity extends Serializable>
PagedResult<TEntity>empty()
Returns an empty paged result.static <TEntity extends Serializable>
PagedResult<TEntity>forList(List<TEntity> totalResults, int page, int pageSize)
Returns aPagedResult
for the given list of total results and paging.List<TEntity>
getResult()
int
getTotalCount()
-
-
-
Method Detail
-
empty
public static <TEntity extends Serializable> PagedResult<TEntity> empty()
Returns an empty paged result.- Type Parameters:
TEntity
- typ of the entities expected to be in the result page.- Returns:
- an empty paged result.
-
forList
public static <TEntity extends Serializable> PagedResult<TEntity> forList(List<TEntity> totalResults, int page, int pageSize)
Returns aPagedResult
for the given list of total results and paging. The result list will be return partitioned of the given total result list according to the given paging.- Type Parameters:
TEntity
- type of object to get a paged result for.- Parameters:
totalResults
- all results.page
- to get. If a page less than or equal tozero
is given, paging is disabled and all entities are returned in one page.pageSize
- size of the page to get. If a page size less thanzero
is given, paging is disabled and all entities are returned in one page.- Returns:
- a paged result of the given list of total results.
-
getTotalCount
public int getTotalCount()
-
-