Skip to content

Commit f598965

Browse files
committed
Use Lombok for StripeCollection
1 parent 5ba9499 commit f598965

File tree

1 file changed

+21
-76
lines changed

1 file changed

+21
-76
lines changed

src/main/java/com/stripe/model/StripeCollection.java

+21-76
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
import java.util.List;
66
import java.util.Map;
77

8+
import lombok.EqualsAndHashCode;
9+
import lombok.Getter;
10+
import lombok.Setter;
11+
812
/**
913
* Provides a representation of a single page worth of data from the Stripe
1014
* API.
@@ -31,69 +35,30 @@
3135
* }
3236
* </pre>
3337
*/
38+
@Getter
39+
@Setter
40+
@EqualsAndHashCode(callSuper = false)
3441
public abstract class StripeCollection<T extends HasId> extends StripeObject
3542
implements StripeCollectionInterface<T> {
36-
List<T> data;
37-
Long totalCount;
38-
Boolean hasMore;
39-
private RequestOptions requestOptions;
40-
private Map<String, Object> requestParams;
41-
String url;
43+
String object;
44+
@Getter(onMethod = @__({@Override})) List<T> data;
45+
@Getter(onMethod = @__({@Override})) Boolean hasMore;
46+
@Getter(onMethod = @__({@Override})) Long totalCount;
47+
@Getter(onMethod = @__({@Override})) String url;
4248

4349
/**
44-
* 3/2014: Legacy (from before newstyle pagination API).
50+
* The {@code count} attribute.
51+
*
52+
* @deprecated Use pagination parameters instead.
53+
* @see <a href="https://stripe.com/docs/api/java#pagination">Pagination</a>
4554
*/
55+
@Deprecated
4656
Long count;
4757

48-
@Override
49-
public List<T> getData() {
50-
return data;
51-
}
52-
53-
public void setData(List<T> data) {
54-
this.data = data;
55-
}
56-
57-
@Override
58-
public Long getTotalCount() {
59-
return totalCount;
60-
}
61-
62-
public void setTotalCount(Long totalCount) {
63-
this.totalCount = totalCount;
64-
}
65-
66-
@Override
67-
public Boolean getHasMore() {
68-
return hasMore;
69-
}
70-
71-
public void setHasMore(Boolean hasMore) {
72-
this.hasMore = hasMore;
73-
}
74-
75-
@Override
76-
public String getUrl() {
77-
return url;
78-
}
79-
80-
public void setUrl(String url) {
81-
this.url = url;
82-
}
83-
84-
/**
85-
* 3/2014: Legacy (from before newstyle pagination API).
86-
*/
87-
public Long getCount() {
88-
return count;
89-
}
90-
91-
/**
92-
* 3/2014: Legacy (from before newstyle pagination API).
93-
*/
94-
public void setCount(Long count) {
95-
this.count = count;
96-
}
58+
@Getter(onMethod = @__({@Override})) @Setter(onMethod = @__({@Override}))
59+
private RequestOptions requestOptions;
60+
@Getter(onMethod = @__({@Override})) @Setter(onMethod = @__({@Override}))
61+
private Map<String, Object> requestParams;
9762

9863
public Iterable<T> autoPagingIterable() {
9964
return new PagingIterable<T>(this);
@@ -117,24 +82,4 @@ public Iterable<T> autoPagingIterable(Map<String, Object> params, RequestOptions
11782
this.setRequestParams(params);
11883
return new PagingIterable<T>(this);
11984
}
120-
121-
@Override
122-
public RequestOptions getRequestOptions() {
123-
return this.requestOptions;
124-
}
125-
126-
@Override
127-
public Map<String, Object> getRequestParams() {
128-
return this.requestParams;
129-
}
130-
131-
@Override
132-
public void setRequestOptions(RequestOptions requestOptions) {
133-
this.requestOptions = requestOptions;
134-
}
135-
136-
@Override
137-
public void setRequestParams(Map<String, Object> requestParams) {
138-
this.requestParams = requestParams;
139-
}
14085
}

0 commit comments

Comments
 (0)