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
A wrapper around a list of content.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPageResponseImpl.Builder<E,B extends PageResponseImpl.Builder<E, B>> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPageResponseImpl(PageResponseImpl.Builder<T, ? extends PageResponseImpl.Builder> builder) -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> PageResponseImpl.Builder<T, ? extends PageResponseImpl.Builder<T, ?>> builder()static <T> PageResponseImpl<T> empty(boolean hasMore) static <T> PageResponseImpl<T> empty(boolean hasMore, LimitedRequest request) static <T> PageResponseImpl<T> empty(boolean hasMore, PageRequest request) booleanstatic <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.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.static <T> PageResponse<T> from(PageResponse<T> pageResponse, Optional<Long> totalCount) static <T> PageResponseImpl.Builder<T, ? extends PageResponseImpl.Builder> static <T> PageResponseImpl.Builder<T, ? extends PageResponseImpl.Builder> fromSingle(T element, boolean hasMore) Possible to return total number of resultinthashCode()booleanhasMore()Indicates whether the source has more results after this page.iterator()intsize()toString()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.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
PageResponseImpl
-
-
Method Details
-
getPageRequest
- Specified by:
getPageRequestin interfacePageResponse<T>- Returns:
- the request used to produce this response
-
getTotalCount
Description copied from interface:PageResponsePossible to return total number of result- Specified by:
getTotalCountin interfacePageResponse<T>- Returns:
-
iterator
-
size
public int size()- Specified by:
sizein interfacePageResponse<T>- Returns:
- the number of results in this page of results
-
getResults
- Specified by:
getResultsin interfacePageResponse<T>- Returns:
- the results
-
hasMore
public boolean hasMore()Description copied from interface:PageResponseIndicates whether the source has more results after this page.- Specified by:
hasMorein interfacePageResponse<T>- Returns:
- true if there are more results
-
getNextCursor
- Specified by:
getNextCursorin interfacePageResponse<T>- Returns:
- the identifier which is used to skip results from a previous query when paginating in forward direction.
-
getPrevCursor
- Specified by:
getPrevCursorin interfacePageResponse<T>- Returns:
- the identifier which is used to skip results from a previous query when paginating in backward direction.
-
toString
-
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
-
empty
-
empty
-
equals
-
hashCode
public int hashCode() -
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
-
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 databaseitems- 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 cursorascComparator- 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
-