• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #14893

05 Oct 2023 05:56PM UTC coverage: 19.967% (+0.01%) from 19.955%
#14893

push

github-actions

web-flow
Merge pull request #1663 from stripe/richardm-fix-autopagination-deserialization-issue

Flow type information further into autopagination requests

29 of 29 new or added lines in 9 files covered. (100.0%)

17118 of 85730 relevant lines covered (19.97%)

0.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/main/java/com/stripe/model/StripeSearchResult.java
1
package com.stripe.model;
2

3
import com.stripe.net.RequestOptions;
4
import com.stripe.net.StripeResponseGetter;
5
import java.lang.reflect.Type;
6
import java.util.List;
7
import java.util.Map;
8
import lombok.EqualsAndHashCode;
9
import lombok.Getter;
10
import lombok.Setter;
11

12
/** Provides a representation of a single page worth of data from a Stripe API search method. */
13
@Getter
14
@Setter
15
@EqualsAndHashCode(callSuper = false)
16
public class StripeSearchResult<T> extends StripeObject
1✔
17
    implements StripeSearchResultInterface<T>, StripeActiveObject {
18
  private transient StripeResponseGetter responseGetter;
19
  String object;
20

21
  @Getter(onMethod_ = {@Override})
22
  List<T> data;
23

24
  /**
25
   * Get the total count of search records in the result. The value is present when `total_count` is
26
   * added to the `expand` search parameter.
27
   */
28
  @Getter(onMethod_ = {@Override})
29
  Long totalCount;
30

31
  @Getter(onMethod_ = {@Override})
32
  Boolean hasMore;
33

34
  @Getter(onMethod_ = {@Override})
35
  String url;
36

37
  @Getter(onMethod_ = {@Override})
38
  String nextPage;
39

40
  @Getter(onMethod_ = {@Override})
41
  @Setter(onMethod = @__({@Override}))
42
  private transient RequestOptions requestOptions;
43

44
  @Getter(onMethod_ = {@Override})
45
  @Setter(onMethod = @__({@Override}))
46
  private Map<String, Object> requestParams;
47

48
  @Setter(onMethod = @__({@Override}))
49
  private transient Type pageTypeToken;
50

51
  public Iterable<T> autoPagingIterable() {
52
    this.responseGetter.validateRequestOptions(this.requestOptions);
1✔
53
    return new SearchPagingIterable<>(this, responseGetter, pageTypeToken);
1✔
54
  }
55

56
  public Iterable<T> autoPagingIterable(Map<String, Object> params) {
57
    this.responseGetter.validateRequestOptions(this.requestOptions);
1✔
58
    this.setRequestParams(params);
1✔
59
    return new SearchPagingIterable<>(this, responseGetter, pageTypeToken);
1✔
60
  }
61

62
  /**
63
   * Constructs an iterable that can be used to iterate across all objects across all pages. As page
64
   * boundaries are encountered, the next page will be fetched automatically for continued
65
   * iteration.
66
   *
67
   * @param params request parameters (will override the parameters from the initial list request)
68
   * @param options request options (will override the options from the initial list request)
69
   */
70
  public Iterable<T> autoPagingIterable(Map<String, Object> params, RequestOptions options) {
71
    this.responseGetter.validateRequestOptions(options);
×
72
    this.setRequestOptions(options);
×
73
    this.setRequestParams(params);
×
74
    return new SearchPagingIterable<>(this, responseGetter, pageTypeToken);
×
75
  }
76

77
  @Override
78
  public void setResponseGetter(StripeResponseGetter responseGetter) {
79
    this.responseGetter = responseGetter;
1✔
80

81
    if (this.data != null) {
1✔
82
      for (T item : data) {
1✔
83
        trySetResponseGetter(item, responseGetter);
1✔
84
      }
1✔
85
    }
86
  }
1✔
87
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc