All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.stripe.model.PagingIterable Maven / Gradle / Ivy

There is a newer version: 28.1.0-beta.3
Show newest version
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 PagingIterable implements Iterable {
  private final StripeCollectionInterface page;
  private final StripeResponseGetter responseGetter;
  private final Type pageType;

  PagingIterable(
      final StripeCollectionInterface page, StripeResponseGetter responseGetter, Type pageType) {

    this.page = page;
    this.responseGetter = responseGetter;
    this.pageType = pageType;
  }

  @Override
  public Iterator iterator() {
    return new PagingIterator<>(page, responseGetter, pageType);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy