Remove StripeAPIResourceCollection #294
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current implementation has two collection implementations:
StripeAPIResourceCollection
: ExtendsAPIResource
; used when acollection needs access to either
request
orrequestCollection
.StripeAPICollection
: Used in all other situations.The two collection implementations are functionally identical except for
their parent class. This is somewhat error prone because as seen in #292,
it's easy to add something to one and forget about the other.
This pull eliminates
StripeAPIResourceCollection
and moves allcollections over to just extend
StripeCollection
, solving theduplication problem and reducing code complexity.
The downside is that I've moved visibility of
request
andrequestCollection
onAPIResource
to public so that they can becalled into from collection classes. It would be better if these had
something like
internal
visibility (a la C#), but Java doesn't reallysupport anything like that. IMO, it's still a reasonable trade-off and
we should still consider those
request*
methods "effectively" privateto the package and not part of the public API.
Fixes #292.
/cc @olivierbellone Thoughts on this one? Thanks!