com.atlassian.confluence.api.model.pagination
Class PageResponseImpl<T>

java.lang.Object
  extended by com.atlassian.confluence.api.model.pagination.PageResponseImpl<T>
Type Parameters:
T -
All Implemented Interfaces:
PageResponse<T>, Iterable<T>

public class PageResponseImpl<T>
extends Object
implements PageResponse<T>

A wrapper around a list of content.


Nested Class Summary
static class PageResponseImpl.Builder<T>
           
 
Method Summary
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)
          Reduces a list of items for a limited request by the predicate provided.
static
<T> PageResponseImpl.Builder<T>
from(Iterable<T> list, boolean hasMore)
           
static
<T> PageResponseImpl.Builder<T>
fromSingle(T element, boolean hasMore)
           
 PageRequest getPageRequest()
           
 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)
          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
 

Method Detail

getPageRequest

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

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

toString

public String toString()
Overrides:
toString in class Object

from

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

fromSingle

public static <T> PageResponseImpl.Builder<T> fromSingle(T element,
                                                         boolean hasMore)

transform

public static <F,T> PageResponseImpl<T> transform(PageResponse<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. All other attributes of PageResponse are kept intact.


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

public static <T> PageResponse<T> filteredPageResponse(LimitedRequest limitedRequest,
                                                       List<T> items,
                                                       com.google.common.base.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...



Copyright © 2003–2015 Atlassian. All rights reserved.