Class PageResponseImpl<T>

java.lang.Object
com.atlassian.confluence.api.model.pagination.PageResponseImpl<T>
All Implemented Interfaces:
PageResponse<T>, Iterable<T>
Direct Known Subclasses:
ContentRestrictionsPageResponse

public class PageResponseImpl<T> extends Object implements PageResponse<T>
A wrapper around a list of content.
  • Constructor Details

  • Method Details

    • getPageRequest

      public PageRequest getPageRequest()
      Specified by:
      getPageRequest in interface PageResponse<T>
      Returns:
      the request used to produce this response
    • getTotalCount

      public Optional<Long> getTotalCount()
      Description copied from interface: PageResponse
      Possible to return total number of result
      Specified by:
      getTotalCount in interface PageResponse<T>
      Returns:
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • size

      public int size()
      Specified by:
      size in interface PageResponse<T>
      Returns:
      the number of results in this page of results
    • getResults

      public List<T> getResults()
      Specified by:
      getResults in interface PageResponse<T>
      Returns:
      the results
    • hasMore

      public boolean hasMore()
      Description copied from interface: PageResponse
      Indicates whether the source has more results after this page.
      Specified by:
      hasMore in interface PageResponse<T>
      Returns:
      true if there are more results
    • getNextCursor

      public Cursor getNextCursor()
      Specified by:
      getNextCursor in interface PageResponse<T>
      Returns:
      the identifier which is used to skip results from a previous query when paginating in forward direction.
    • getPrevCursor

      public Cursor getPrevCursor()
      Specified by:
      getPrevCursor in interface PageResponse<T>
      Returns:
      the identifier which is used to skip results from a previous query when paginating in backward direction.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static <T> PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder> from(Iterable<T> list, boolean hasMore)
    • fromSingle

      public static <T> PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder> fromSingle(T element, boolean hasMore)
    • transformResponse

      public static <F, T> PageResponseImpl<T> transformResponse(PageResponse<F> input, Function<F,T> mapper)
      Converts a given PageResponse contains items of type F into an equivalent PageResponse with items of type T, transformed by the given mapper. All other attributes of PageResponse are kept intact.
      Since:
      6.10.0
    • empty

      public static <T> PageResponseImpl<T> empty(boolean hasMore)
    • empty

      public static <T> PageResponseImpl<T> empty(boolean hasMore, PageRequest request)
    • empty

      public static <T> PageResponseImpl<T> empty(boolean hasMore, LimitedRequest request)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • filteredResponse

      public static <T> PageResponse<T> filteredResponse(LimitedRequest limitedRequest, List<T> items, Predicate<? super T> predicate)
      Reduces a list of items for a limited request by the predicate provided. Useful for permission checks that are known to the Manager layer...
      Since:
      6.10.0
    • from

      public static <T> PageResponse<T> from(PageResponse<T> pageResponse, Optional<Long> totalCount)
    • filteredResponseWithCursor

      public static <T> PageResponse<T> filteredResponseWithCursor(LimitedRequest limitedRequest, List<T> items, Predicate<? super T> predicate, BiFunction<T,Boolean,Cursor> cursorCalculator, Comparator<T> ascComparator)
      Reduces a list of items for a limited request by the predicate provided. Useful for permission checks that are known to the Manager layer
      Parameters:
      limitedRequest - Request that was used to obtain items from database
      items - Records returned from database (we could have more records than was requested by limit)
      predicate - Filter (for e.g. permission checks could be performed by this filter)
      cursorCalculator - Function that is used to create new cursor
      ascComparator - Comparator to sort records in ascending order
      Returns:
      A page response with records sorted in asc order and with calculated next and prev cursor
      Since:
      7.18
    • builder

      public static <T> PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder<T,?>> builder()