java.lang.Object
org.springframework.data.mongodb.repository.util.SliceUtils

public class SliceUtils extends Object
Utility methods for Slice handling.
Since:
4.5
Author:
Mark Paluch, Christoph Strobl
  • Constructor Details

    • SliceUtils

      public SliceUtils()
  • Method Details

    • sliceResult

      public static <T> Slice<T> sliceResult(List<T> resultList, Pageable pageable)
      Creates a Slice given Pageable and List of results.
      Type Parameters:
      T - the element type.
      Parameters:
      resultList - the source list holding the result of the request. If the result list contains more elements (indicating a next slice is available) it is trimmed to the page size.
      pageable - the source pageable.
      Returns:
      new instance of Slice.
    • limitResult

      public static Query limitResult(Query query, Pageable pageable)
      Customize query for sliced result retrieval. If paged the limit is set to pagesize + 1 in order to determine if more data is available.
      Parameters:
      query - the source query
      pageable - paging to apply.
      Returns:
      new instance of Query if either paged, the source query otherwise.