com.stripe.model.SearchPagingIterable Maven / Gradle / Ivy
package com.stripe.model;
import com.stripe.net.StripeResponseGetter;
import java.lang.reflect.Type;
import java.util.Iterator;
/**
* Provides an {@code Iterable}
target that automatically iterates across all API
* pages and which is suitable for use with a {@code foreach}
loop.
*/
public class SearchPagingIterable implements Iterable {
private final StripeSearchResultInterface page;
private final StripeResponseGetter responseGetter;
private final Type pageType;
SearchPagingIterable(
final StripeSearchResultInterface page,
StripeResponseGetter responseGetter,
Type pageType) {
this.page = page;
this.responseGetter = responseGetter;
this.pageType = pageType;
}
@Override
public Iterator iterator() {
return new SearchPagingIterator<>(page, responseGetter, pageType);
}
}