public abstract class StripeCollection<T extends HasId> extends StripeObject implements StripeCollectionInterface<T>
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());
}
PRETTY_PRINT_GSON
Constructor and Description |
---|
StripeCollection() |
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<T> |
autoPagingIterable()
Returns an iterable that can be used to iterate across all objects
across all pages.
|
java.lang.Integer |
getCount()
3/2014: Legacy (from before newstyle pagination API)
|
java.util.List<T> |
getData() |
java.lang.Boolean |
getHasMore() |
RequestOptions |
getRequestOptions()
Get request options that were used to fetch the collection.
|
java.util.Map<java.lang.String,java.lang.Object> |
getRequestParams()
Get request parameters that were used to fetch the collection.
|
java.lang.Integer |
getTotalCount() |
java.lang.String |
getURL() |
void |
setCount(java.lang.Integer count)
3/2014: Legacy (from before newstyle pagination API)
|
void |
setData(java.util.List<T> data) |
void |
setHasMore(java.lang.Boolean hasMore) |
void |
setRequestOptions(RequestOptions requestOptions)
Set request options that were used to fetch the collection.
|
void |
setRequestParams(java.util.Map<java.lang.String,java.lang.Object> requestParams)
Set request parameters that were used to fetch the collection.
|
void |
setTotalCount(java.lang.Integer totalCount) |
void |
setURL(java.lang.String url) |
equals, getLastResponse, setLastResponse, toJson, toString
public java.util.List<T> getData()
getData
in interface StripeCollectionInterface<T extends HasId>
public void setData(java.util.List<T> data)
public java.lang.Integer getTotalCount()
getTotalCount
in interface StripeCollectionInterface<T extends HasId>
public void setTotalCount(java.lang.Integer totalCount)
public java.lang.Boolean getHasMore()
getHasMore
in interface StripeCollectionInterface<T extends HasId>
public void setHasMore(java.lang.Boolean hasMore)
public java.lang.String getURL()
getURL
in interface StripeCollectionInterface<T extends HasId>
public void setURL(java.lang.String url)
public java.lang.Integer getCount()
public void setCount(java.lang.Integer count)
public java.lang.Iterable<T> autoPagingIterable()
public RequestOptions getRequestOptions()
StripeCollectionInterface
getRequestOptions
in interface StripeCollectionInterface<T extends HasId>
public java.util.Map<java.lang.String,java.lang.Object> getRequestParams()
StripeCollectionInterface
getRequestParams
in interface StripeCollectionInterface<T extends HasId>
public void setRequestOptions(RequestOptions requestOptions)
StripeCollectionInterface
setRequestOptions
in interface StripeCollectionInterface<T extends HasId>
public void setRequestParams(java.util.Map<java.lang.String,java.lang.Object> requestParams)
StripeCollectionInterface
setRequestParams
in interface StripeCollectionInterface<T extends HasId>