Class PageResponseImpl<T>

    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface PageResponse<T>
        Returns:
        the number of results in this page of 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.
      • transform

        @Deprecated
        public static <F,​T> PageResponseImpl<T> transform​(PageResponse<F> input,
                                                                com.google.common.base.Function<F,​T> mapper)
        Deprecated.
        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.
      • 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
      • 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
      • 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