Class PagingParams

java.lang.Object
org.pipservices3.commons.data.PagingParams

public class PagingParams extends Object
Data transfer object to pass paging parameters for queries. The page is defined by two parameters. The skip parameter defines number of items to skip. The paging parameter sets how many items to return in a 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 ###

 
 FilterParams filter = FilterParams.fromTuples("type", "Type1");
 PagingParams paging = new PagingParams(0, 100);
 
 myDataClient.getDataByFilter(filter, paging);
 
 
  • Constructor Details

    • PagingParams

      public PagingParams()
    • PagingParams

      public PagingParams(Object skip, Object take, Object total)
      Creates a new instance and sets its values.
      Parameters:
      skip - the number of items to skip.
      take - the number of items to return.
      total - true to return the total number of items.
  • Method Details

    • getSkip

      public Long getSkip()
      Gets the number of items to skip.
      Returns:
      the number of items to skip.
    • getSkip

      public long getSkip(long minSkip)
      Gets the number of items to skip.
      Parameters:
      minSkip - the minimum number of items to skip.
      Returns:
      the number of items to skip.
    • getTake

      public Long getTake()
      Gets the number of items to return in a page.
      Returns:
      the number of items to return.
    • setSkip

      public void setSkip(long value)
      Sets value to skip
      Parameters:
      value - value to set skip
    • getTake

      public long getTake(long maxTake)
      Gets the number of items to return in a page.
      Parameters:
      maxTake - the maximum number of items to return.
      Returns:
      the number of items to return.
    • setTake

      public void setTake(long value)
      Sets value to take
      Parameters:
      value - value to set take
    • hasTotal

      public boolean hasTotal()
      Returns:
      value of total
    • setTotal

      public void setTotal(boolean value)
      Sets value to total
      Parameters:
      value - value to set total
    • fromValue

      public static PagingParams fromValue(Object value)
      Converts specified value into PagingParams.
      Parameters:
      value - value to be converted
      Returns:
      a newly created PagingParams.
    • fromTuples

      public static PagingParams fromTuples(Object... tuples)
      Creates a new PagingParams from a list of key-value pairs called tuples.
      Parameters:
      tuples - a list of values where odd elements are keys and the following even elements are values
      Returns:
      a newly created PagingParams.
    • fromMap

      public static PagingParams fromMap(AnyValueMap map)
      Creates a new PagingParams and sets it parameters from the AnyValueMap map
      Parameters:
      map - a AnyValueMap to initialize this PagingParams
      Returns:
      a newly created PagingParams.
    • fromMap

      public static PagingParams fromMap(StringValueMap map)
      Creates a new PagingParams and sets it parameters from the StringValueMap map
      Parameters:
      map - a StringValueMap to initialize this PagingParams
      Returns:
      a newly created PagingParams.