@Internal public class PagedResponseImpl<T> extends Object implements PagedResponse<T>
Modifier and Type | Class and Description |
---|---|
static class |
PagedResponseImpl.Builder<T>
Builds PagedResponse's of T
|
Modifier | Constructor and Description |
---|---|
protected |
PagedResponseImpl(PagedResponseImpl.Builder<T> builder) |
Modifier and Type | Method and Description |
---|---|
static <T> PagedResponseImpl<T> |
empty(boolean hasMore)
Returns an empty PagedResponse with the specified hasNextPage flag
|
static <T> PagedResponseImpl<T> |
empty(boolean hasMore,
LimitedPagedRequest request)
Returns an empty PagedResponse
|
static <T> PagedResponseImpl<T> |
empty(boolean hasMore,
PagedRequest request)
Returns an empty PagedResponse
|
static <T> PagedResponse<T> |
filteredPageResponse(LimitedPagedRequest limitedPagedRequest,
List<T> items,
com.google.common.base.Predicate<? super T> predicate)
Reduces a list of items for a limited request by the predicate provided.
|
Optional<T> |
findFirst() |
static <T> PagedResponseImpl.Builder<T> |
from(Iterable<T> list,
boolean hasMore)
A builder of PagedResponse's that starts with the specified list
|
static <T> PagedResponseImpl.Builder<T> |
fromSingle(boolean hasMore,
T element)
A builder of PagedResponse's that starts with the single element
|
PagedRequest |
getPagedRequest() |
List<T> |
getResults() |
boolean |
hasNextPage()
Indicates whether the source has more results after this page.
|
Iterator<T> |
iterator() |
<M> PagedResponse<M> |
map(com.google.common.base.Function<T,M> mapper)
Allows you to map a paged response of T into M
|
int |
size() |
static <T> PagedResponse<T> |
sortAndToPagedResponse(LimitedPagedRequest limitedPagedRequest,
List<T> items,
Comparator<T> comparator)
Use the provided
Comparator to sort and reduces a list of items to the system enforced limited page size. |
static <T> PagedResponse<T> |
toPagedResponse(LimitedPagedRequest limitedPagedRequest,
List<T> items)
Reduces a list of items to the system enforced limited page size.
|
String |
toString() |
static <F,T> PagedResponseImpl<T> |
transform(PagedResponse<F> input,
com.google.common.base.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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected PagedResponseImpl(PagedResponseImpl.Builder<T> builder)
public PagedRequest getPagedRequest()
getPagedRequest
in interface PagedResponse<T>
public int size()
size
in interface PagedResponse<T>
public List<T> getResults()
getResults
in interface PagedResponse<T>
public boolean hasNextPage()
PagedResponse
hasNextPage
in interface PagedResponse<T>
public <M> PagedResponse<M> map(com.google.common.base.Function<T,M> mapper)
PagedResponse
map
in interface PagedResponse<T>
M
- the output typemapper
- the mapping functionpublic Optional<T> findFirst()
findFirst
in interface PagedResponse<T>
public static <T> PagedResponseImpl.Builder<T> from(Iterable<T> list, boolean hasMore)
list
- the starting elementshasMore
- does it have morepublic static <T> PagedResponseImpl.Builder<T> fromSingle(boolean hasMore, T element)
hasMore
- does it have moreelement
- the starting elementpublic static <F,T> PagedResponseImpl<T> transform(PagedResponse<F> input, com.google.common.base.Function<F,T> mapper)
public static <T> PagedResponseImpl<T> empty(boolean hasMore)
hasMore
- whether the response actually has morepublic static <T> PagedResponseImpl<T> empty(boolean hasMore, PagedRequest request)
hasMore
- whether the response actually has morerequest
- the input paged requestpublic static <T> PagedResponseImpl<T> empty(boolean hasMore, LimitedPagedRequest request)
hasMore
- whether the response actually has morerequest
- the input paged requestpublic static <T> PagedResponse<T> toPagedResponse(LimitedPagedRequest limitedPagedRequest, List<T> items)
PagedResponse
that is of the limited sizepublic static <T> PagedResponse<T> sortAndToPagedResponse(LimitedPagedRequest limitedPagedRequest, List<T> items, Comparator<T> comparator)
Comparator
to sort and reduces a list of items to the system enforced limited page size.PagedResponse
that is of the limited sizepublic static <T> PagedResponse<T> filteredPageResponse(LimitedPagedRequest limitedPagedRequest, List<T> items, com.google.common.base.Predicate<? super T> predicate)
Copyright © 2017 Atlassian. All rights reserved.