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

Add toString() to all classes #335

Open
numeralnathan opened this issue Mar 3, 2022 · 3 comments
Open

Add toString() to all classes #335

numeralnathan opened this issue Mar 3, 2022 · 3 comments

Comments

@numeralnathan
Copy link

numeralnathan commented Mar 3, 2022

Please implement toString() in all classes. This will help when debugging since the programmer can see what the state of the object is.

@jhalterman
Copy link
Member

Did you have classes in particular packages in mind, or all of them?

@numeralnathan
Copy link
Author

All of them.

I was stepping through code that was calling RetryPolicyBuilder. It would be nice to see the state in the debugger to make sure I got the code right. I know I can expand the object and see it's fields, but this interrupts my flow.

Note: RetryPolicyImpl does not have any state except RetryPolicyConfig. So, this would be the implementation of RetryPolicyImpl.toString().

@Override
public String toString() {
   return config.toString();
}

However, RetryPolicyConfig has a lot of state. So, perhaps toString() only returns the values that are set. For example, if jitter is not set, then toString() won't show it.

@magicprinc
Copy link

The easiest solution to make it done in five minutes :-)

https://projectlombok.org/features/ToString

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

No branches or pull requests

3 participants