public abstract class Page<T> extends Object implements Iterable<T>
The items themselves are accessed by treating the page as an Iterable.
To get the next or previous page of query results, if any, pass a PageReference
obtained from getNext() or getPrevious() to the client's generic
MarketplaceClient.getMore(com.atlassian.marketplace.client.api.PageReference<T>) method.
for the type of items. For instance, for plugin listings:
Page<AddonSummary> aPage = client.addons().find(addonQuery);
if (aPage.getNext().isDefined())
{
for (PageReference<AddonSummary> next: aPage.getNext())
{
Page<AddonSummary> nextPage = client.getMore(next);
}
}
| Modifier and Type | Field and Description |
|---|---|
protected PageReader<T> |
reader |
| Modifier | Constructor and Description |
|---|---|
protected |
Page(Iterable<T> items,
int totalSize,
PageReader<T> reader) |
| Modifier and Type | Method and Description |
|---|---|
static <T> Page<T> |
empty()
Returns a Page containing no items, with no server URI (
getReference(), getNext(),
and getPrevious() will all return Option.none()). |
static <T> Page<T> |
empty(Class<T> type)
Returns a Page containing no items, with no server URI (
getReference(), getNext(),
and getPrevious() will all return Option.none()). |
static <T> Page<T> |
fromItems(Iterable<T> items)
Returns a Page from a fixed list of items, with no server URI (
getReference(),
getNext(), and getPrevious() will all return Option.none()). |
abstract com.atlassian.fugue.Option<PageReference<T>> |
getNext()
If there are other items after this subset in the full result set, returns a
PageReference
allowing you to query the next page; otherwise returns Option.none(). |
int |
getOffset()
Shortcut for getReference().get().getOffset(), but returns zero if getReference()
is none().
|
abstract com.atlassian.fugue.Option<PageReference<T>> |
getPrevious()
If there are other items before this subset in the full result set, returns a
PageReference
allowing you to query the previous page; otherwise returns Option.none(). |
abstract com.atlassian.fugue.Option<PageReference<T>> |
getReference()
Returns a reference to the address of this query page on the server allowing it to be requeried
in the future, or
Option.none() if it does not exist on the server. |
Iterator<T> |
iterator() |
int |
size()
The number of items on this page.
|
int |
totalSize()
The number of items in the entire result set, of which this page is a subset.
|
protected final PageReader<T> reader
protected Page(Iterable<T> items, int totalSize, PageReader<T> reader)
public static <T> Page<T> empty()
getReference(), getNext(),
and getPrevious() will all return Option.none()).public static <T> Page<T> empty(Class<T> type)
getReference(), getNext(),
and getPrevious() will all return Option.none()).public static <T> Page<T> fromItems(Iterable<T> items)
getReference(),
getNext(), and getPrevious() will all return Option.none()).public int size()
public int totalSize()
public abstract com.atlassian.fugue.Option<PageReference<T>> getReference()
Option.none() if it does not exist on the server.public abstract com.atlassian.fugue.Option<PageReference<T>> getPrevious()
PageReference
allowing you to query the previous page; otherwise returns Option.none().public abstract com.atlassian.fugue.Option<PageReference<T>> getNext()
PageReference
allowing you to query the next page; otherwise returns Option.none().public int getOffset()
Copyright © 2016 Atlassian. All rights reserved.