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:
  • Constructor Details

    • PaginatedResult

      public PaginatedResult()
  • Method Details

    • 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