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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PageResponseImpl.Builder<E,B extends PageResponseImpl.Builder<E,B>>
-
Constructor Summary
Constructors Modifier Constructor Description protected
PageResponseImpl(PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <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)
static <T> PageResponse<T>
filteredPageResponse(LimitedRequest limitedRequest, List<T> items, com.google.common.base.Predicate<? super T> predicate)
Deprecated.since 6.10.0.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.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> PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder>
from(Iterable<T> list, boolean hasMore)
static <T> PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder>
fromSingle(T element, boolean hasMore)
Cursor
getNextCursor()
PageRequest
getPageRequest()
Cursor
getPrevCursor()
List<T>
getResults()
boolean
hasMore()
Indicates whether the source has more results after this page.Iterator<T>
iterator()
int
size()
String
toString()
static <F,T>
PageResponseImpl<T>transform(PageResponse<F> input, com.google.common.base.Function<F,T> mapper)
Deprecated.since 6.10.0.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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
PageResponseImpl
protected PageResponseImpl(PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder> builder)
-
-
Method Detail
-
getPageRequest
public PageRequest getPageRequest()
- Specified by:
getPageRequest
in interfacePageResponse<T>
- Returns:
- the request used to produce this response
-
size
public int size()
- Specified by:
size
in interfacePageResponse<T>
- Returns:
- the number of results in this page of results
-
getResults
public List<T> getResults()
- Specified by:
getResults
in interfacePageResponse<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 interfacePageResponse<T>
- Returns:
- true if there are more results
-
getNextCursor
public Cursor getNextCursor()
- Specified by:
getNextCursor
in interfacePageResponse<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 interfacePageResponse<T>
- Returns:
- the identifier which is used to skip results from a previous query when paginating in backward direction.
-
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)
-
transform
@Deprecated public static <F,T> PageResponseImpl<T> transform(PageResponse<F> input, com.google.common.base.Function<F,T> mapper)
Deprecated.since 6.10.0. UsetransformResponse(PageResponse, Function)
instead.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
-
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)
-
filteredPageResponse
@Deprecated public static <T> PageResponse<T> filteredPageResponse(LimitedRequest limitedRequest, List<T> items, com.google.common.base.Predicate<? super T> predicate)
Deprecated.since 6.10.0. UsefilteredResponse(LimitedRequest, List, Predicate)
instead.Reduces a list of items for a limited request by the predicate provided. Useful for permission checks that are known to the Manager layer...
-
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 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
public static <T> PageResponseImpl.Builder<T,? extends PageResponseImpl.Builder<T,?>> builder()
-
-