Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toString methods are missing #57

Open
uwemaurer opened this issue Jan 5, 2018 · 9 comments
Open

toString methods are missing #57

uwemaurer opened this issue Jan 5, 2018 · 9 comments
Labels

Comments

@uwemaurer
Copy link

the library would be much easier to work with if there were toString() methods on the classes

@crookedneighbor
Copy link
Contributor

Thanks for the feedback, we'll take it into consideration. Adding this is not on our current roadmap, but I can see how it would be useful.

As always, PRs are welcome!

@kmichalak
Copy link

What in your opinion is the best approach of implementing toString() methods for SDK classes? Should it be some JSON like structure that represents all object properties or something more sophisticated, like for example this

Transaction@182f0db={
    amount: "100.88",
    creditCard: CreditCard@152ffda={
        cardType: "AMEX".
        customerId: "123",
        subscriptions: []
    }
}

What should be a date/time format of a string representation?
@uwemaurer Is there some subset of classes in the library that should have toString() method, or you rather thought about adding it to all of them?

@uwemaurer
Copy link
Author

Just the IDE generated toString() implementation is fine. For the date format you can just call the date objects toString() method.

The response classes which are returned by the API are most important to have a toString() method.

@kmichalak
Copy link

If such implementation of toString() method is fine for you, I'll prepare some PR in a couple of days.

@jaypatel512
Copy link
Contributor

Hey all !

Just a quick update. We have taken this into consideration. We are fancying the idea of using lombok library to do the heavy lifting for us. Currently, the idea is to use it for toString method only, but hopefully more in future, if things go out well. We are still testing a bunch of changes, and making sure it will not cause a breaking change to us. We will keep you posted.

@kmichalak
Copy link

Thanks for notification. As this is curretnly in progress, then no additional changes/pull requests will be needed from my side?

@jaypatel512
Copy link
Contributor

A quick update. We have not forgotten you. We are running into issues using lombok with Java 7. We are working our way trying to fix that, and making a lot of new features from lombok available for our library. Apologies for the delay.

@atuttle
Copy link

atuttle commented Apr 20, 2021

I am very interested in this feature (and/or #80).

I am using Braintree in a language that runs on top of Java, but I am not a java developer so unfortunately I can't offer any hope of a PR. We need to store the charge response in our database for record-keeping, but the SDK returns java objects that are not serializable. The toString() method simply prints the class name, e.g. com.braintreegateway.Result@1c1538d2 and nothing more.

I can spelunk through the response methods and cobble together my own native-data representation of the result and then serialize that, but the number of possibilities that would need to be accounted for in the variations of response contents would be very high (for example, responses can be significantly different between charges made with cc/venmo/paypal/google pay/apple pay).

@hollabaq86
Copy link
Contributor

for internal notekeeping, ticket 631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants