Package alpine.persistence
Class PaginatedResult
- java.lang.Object
-
- alpine.persistence.PaginatedResult
-
- All Implemented Interfaces:
Serializable
public class PaginatedResult extends Object implements Serializable
PaginatedResult is a container class that provides a complete (or partial) Collection (List/Set) of results along with the total number of results for the query.- Since:
- 1.0.0
- Author:
- Steve Springett
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PaginatedResult()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> List<T>getList(Class<T> clazz)Retrieves a List of objects from the result.CollectiongetObjects()Retrieves a Collection of objects from the result.<T> Set<T>getSet(Class<T> clazz)Retrieves a Set of objects from the result.longgetTotal()Retrieves the total number of results.PaginatedResultobjects(Object object)Fluent.PaginatedResultobjects(Collection<?> collection)Fluent.voidsetObjects(Object object)Specifies a Collection of objects from the result.voidsetObjects(Collection<?> collection)Specifies a Collection of objects from the result.voidsetTotal(long total)Specifies the total number of results.PaginatedResulttotal(long total)Fluent.
-
-
-
Method Detail
-
getTotal
public long getTotal()
Retrieves the total number of results.- Returns:
- the total number of results
- Since:
- 1.0.0
-
setTotal
public void setTotal(long total)
Specifies the total number of results.- Parameters:
total- the total number of results- Since:
- 1.0.0
-
total
public PaginatedResult total(long total)
Fluent. Specifies the total number of results.- Parameters:
total- the total number of results- Returns:
- the current PaginatedResult instance
- Since:
- 1.0.0
-
getObjects
public Collection getObjects()
Retrieves a Collection of objects from the result.- Returns:
- a Collection of objects from the result.
- Since:
- 1.0.0
-
getList
public <T> List<T> getList(Class<T> clazz)
Retrieves a List of objects from the result.- Type Parameters:
T- the type defined in the List- Parameters:
clazz- the type defined in the List- Returns:
- a Collection of objects from the result.
- Since:
- 1.0.0
-
getSet
public <T> Set<T> getSet(Class<T> clazz)
Retrieves a Set of objects from the result.- Type Parameters:
T- the type defined in the Set- Parameters:
clazz- the type defined in the Set- Returns:
- a Collection of objects from the result.
- Since:
- 1.0.0
-
setObjects
public void setObjects(Collection<?> collection)
Specifies a Collection of objects from the result.- Parameters:
collection- a Collection of objects from the result.- Since:
- 1.0.0
-
objects
public PaginatedResult objects(Collection<?> collection)
Fluent. Specifies a Collection of objects from the result.- Parameters:
collection- a Collection of objects from the result.- Returns:
- the current PaginatedResult instance
- Since:
- 1.0.0
-
setObjects
public void setObjects(Object object)
Specifies a Collection of objects from the result.- Parameters:
object- a Collection of objects from the result.- Since:
- 1.0.0
-
objects
public PaginatedResult objects(Object object)
Fluent. Specifies a Collection of objects from the result.- Parameters:
object- a Collection of objects from the result.- Returns:
- the current PaginatedResult instance
- Since:
- 1.0.0
-
-