Class DataPage<T>

java.lang.Object
org.pipservices3.commons.data.DataPage<T>
Type Parameters:
T - class type

public class DataPage<T> extends Object
Data transfer object that is used to pass results of paginated queries. It contains items of retrieved page and optional total number of items.

Most often this object type is used to send responses to paginated queries. Pagination parameters are defined by PagingParams object. The skip parameter in the PagingParams there means how many items to skip. The takes parameter sets number of items to return in the page. And the optional total parameter tells to return total number of items in the query.

Remember: not all implementations support total parameter because its generation may lead to severe performance implications.

### Example ###

 
 myDataClient.getDataByFilter(
   "123",
   FilterParams.fromTuples("completed", true),
   new PagingParams(0, 100, true),
   (DataPage<MyData> page) -> {
       System.out.println("Items: ");
       for (MyData item : page.getData()) {
         System.out.println(item);
       }
       System.out.println("Total items: " + page.getTotal());
   };
 );
 
 
See Also:
  • Constructor Details

    • DataPage

      public DataPage()
    • DataPage

      public DataPage(List<T> data)
      Creates a new instance of data page and assigns its values.
      Parameters:
      data - a list of items from the retrieved page.
    • DataPage

      public DataPage(List<T> data, Long total)
      Creates a new instance of data page and assigns its values.
      Parameters:
      data - a list of items from the retrieved page.
      total - (optional) .
  • Method Details

    • getTotal

      public Long getTotal()
    • setTotal

      public void setTotal(Long value)
    • getData

      public List<T> getData()
    • setData

      public void setData(List<T> value)