public class PagingHandler extends Object
Provides a standard method of handling paging instructions for almost all calls to the Strava API that support paging.
Example - see ActivityServiceImpl.listActivityComments(Integer, Paging)
| Constructor and Description |
|---|
PagingHandler() |
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
handleListAll(PagingCallback<T> callback)
Returns ALL the data from a Strava service that would normally only return a page of data, by simply getting pages 1..n until there's no more data to retrieve
|
static <T> List<T> |
handlePaging(Paging pagingInstruction,
PagingCallback<T> callback)
Validates paging instructions and converts them to Strava-compatible paging instructions, then gets the whole lot for you
|
public static <T> List<T> handlePaging(Paging pagingInstruction, PagingCallback<T> callback)
Validates paging instructions and converts them to Strava-compatible paging instructions, then gets the whole lot for you
The PagingCallback provides the functionality to get a single page of data from Strava
T - The class of objects which will be returned in the listpagingInstruction - The overarching paging instruction to be managedcallback - An implementation of PagingCallback which actually gets the relevant page of data from the Strava APIpublic static <T> List<T> handleListAll(PagingCallback<T> callback)
Returns ALL the data from a Strava service that would normally only return a page of data, by simply getting pages 1..n until there's no more data to retrieve
USE WITH CAUTION! THIS WILL VERY RAPIDLY EAT THROUGH YOUR STRAVA QUOTA!
The PagingCallback provides the method to return a single page of data
T - the parameterised type of list to be returnedcallback - The callback function that returns one page of dataCopyright © 2015 Dan Shannon. All rights reserved.