Class StripeCollection<T extends StripeObjectInterface>

java.lang.Object
com.stripe.model.StripeObject
com.stripe.model.v2.StripeCollection<T>
All Implemented Interfaces:
StripeActiveObject, StripeObjectInterface

public class StripeCollection<T extends StripeObjectInterface> extends StripeObject implements StripeActiveObject
Provides a representation of a single page worth of data from the Stripe API.

The following code will have the effect of iterating through a single page worth of invoice data retrieve from the API:


 foreach (Invoice invoice : Invoice.list(...).getData()) {
   System.out.println("Current invoice = " + invoice.toString());
 }
 

The class also provides a helper for iterating over collections that may be longer than a single page:


 foreach (Invoice invoice : Invoice.list(...).autoPagingIterable()) {
   System.out.println("Current invoice = " + invoice.toString());
 }
 
  • Constructor Details

    • StripeCollection

      public StripeCollection()
  • Method Details

    • autoPagingIterable

      public Iterable<T> autoPagingIterable()
      Constructs an iterable that can be used to iterate across all objects across all pages. As page boundaries are encountered, the next page will be fetched automatically for continued iteration.

      This utilizes the options from the initial list request.

    • autoPagingIterable

      public Iterable<T> autoPagingIterable(RequestOptions options)
      Constructs an iterable that can be used to iterate across all objects across all pages. As page boundaries are encountered, the next page will be fetched automatically for continued iteration.
      Parameters:
      options - request options (will override the options from the initial list request)
    • setResponseGetter

      public void setResponseGetter(StripeResponseGetter responseGetter)
      Description copied from interface: StripeActiveObject
      Method is used by the containing object or StripeResponseGetter implementations to set the StripeResponseGetter instance used to make further requests.
      Specified by:
      setResponseGetter in interface StripeActiveObject
      Parameters:
      responseGetter - the StripeResponseGetter instance to use for making further requests.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • setPageTypeToken

      public void setPageTypeToken(Type pageTypeToken)
    • getData

      public List<T> getData()
    • getNextPageUrl

      public String getNextPageUrl()
    • getPreviousPageUrl

      public String getPreviousPageUrl()
    • getRequestOptions

      public RequestOptions getRequestOptions()
    • setRequestOptions

      public void setRequestOptions(RequestOptions requestOptions)