public final class SamplePage
- Object
- SamplePage
One page of samples, plus the token needed to fetch the next.
String token = null;
do {
SamplePage page = store.readSamplePage(query.setPageToken(token)).get();
process(page.getSamples());
token = page.getNextPageToken();
} while (token != null);
Constructors
public SamplePage(List<HealthSample> samples, String nextPageToken, boolean truncated) | Creates a page. |
Methods
public List<HealthSample> getSamples() | The samples in this page, never null. |
public String getNextPageToken() | The token that fetches the following page, or null when this is the last one. |
public boolean isTruncated() | true when the query’s limit cut the result short and more data matched than was returned. |
public int size() | How many samples this page holds. |
public boolean isEmpty() | true when this page holds no samples. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
SamplePage
public SamplePage(List<HealthSample> samples, String nextPageToken, boolean truncated)Method details
getSamples
public List<HealthSample> getSamples()getNextPageToken
public String getNextPageToken()SampleQuery.setPageToken(String).isTruncated
public boolean isTruncated()true when the query’s limit cut the result short and more data
matched than was returned.
Not a paging instruction. Page on
getNextPageToken() and nothing else. Truncated with a null token
is the store saying the rest is unreachable through this query –
Health Connect resumes per record type, so a page merged from
several types has no token that could return what the merge
dropped. Looping on this flag instead re-issues the same first page
forever. Narrow the range, raise the limit, or query one type at a
time.
A page can also be the last one and still be truncated, which means the store stopped early rather than running out of data – worth surfacing rather than quietly showing a partial total.
size
public int size()isEmpty
public boolean isEmpty()true when this page holds no samples.toString
public String toString()