Vonage / vonage-java-sdk

Vonage Server SDK for Java. API support for SMS, Messages, Voice, Text-to-Speech, Numbers, Verify (2FA), Video and more.
https://developer.vonage.com/en/home
Apache License 2.0
95 stars 119 forks source link

feat: Add toString, equals and hashCode to public domain objects #508

Closed SMadani closed 6 months ago

SMadani commented 6 months ago

Along with addressing #134, this PR aims to add convenience when debugging API responses and using the deserialised objects in collections, by implementing the equals and hashCode methods. The toString is implemented based on the class name and serialised JSON value. A reflective approach is taken to all these methods, using a common base object for JSON payloads in the form of com.vonage.client.JsonableBaseObject, which is implemented throughout the entire classs hierarchy / object graph for all JSON responses, and even some requests.

codecov-commenter commented 6 months ago

Codecov Report

Merging #508 (a79373c) into main (a50c7bb) will increase coverage by 0.93%. The diff coverage is 100.00%.

:exclamation: Current head a79373c differs from pull request most recent head 18cdbbc. Consider uploading reports for the commit 18cdbbc to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #508 +/- ## ============================================ + Coverage 94.26% 95.19% +0.93% + Complexity 2892 2874 -18 ============================================ Files 426 426 Lines 6919 6824 -95 Branches 449 392 -57 ============================================ - Hits 6522 6496 -26 + Misses 204 200 -4 + Partials 193 128 -65 ``` | [Files](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage) | Coverage Δ | | |---|---|---| | [src/main/java/com/vonage/client/HttpWrapper.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9IdHRwV3JhcHBlci5qYXZh) | `100.00% <ø> (ø)` | | | [...ain/java/com/vonage/client/JsonableBaseObject.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9Kc29uYWJsZUJhc2VPYmplY3QuamF2YQ==) | `100.00% <100.00%> (ø)` | | | [...ava/com/vonage/client/account/BalanceResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0JhbGFuY2VSZXNwb25zZS5qYXZh) | `100.00% <ø> (ø)` | | | [...c/main/java/com/vonage/client/account/Country.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0NvdW50cnkuamF2YQ==) | `100.00% <100.00%> (ø)` | | | [...com/vonage/client/account/CreateSecretRequest.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0NyZWF0ZVNlY3JldFJlcXVlc3QuamF2YQ==) | `100.00% <ø> (ø)` | | | [...com/vonage/client/account/FullPricingResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0Z1bGxQcmljaW5nUmVzcG9uc2UuamF2YQ==) | `100.00% <100.00%> (ø)` | | | [...com/vonage/client/account/ListSecretsResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L0xpc3RTZWNyZXRzUmVzcG9uc2UuamF2YQ==) | `75.00% <100.00%> (ø)` | | | [...c/main/java/com/vonage/client/account/Network.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L05ldHdvcmsuamF2YQ==) | `100.00% <100.00%> (ø)` | | | [...m/vonage/client/account/PrefixPricingResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L1ByZWZpeFByaWNpbmdSZXNwb25zZS5qYXZh) | `100.00% <100.00%> (ø)` | | | [...ava/com/vonage/client/account/PricingResponse.java](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage#diff-c3JjL21haW4vamF2YS9jb20vdm9uYWdlL2NsaWVudC9hY2NvdW50L1ByaWNpbmdSZXNwb25zZS5qYXZh) | `100.00% <100.00%> (ø)` | | | ... and [171 more](https://app.codecov.io/gh/Vonage/vonage-java-sdk/pull/508?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Vonage) | |