ToStringBuilder 追加 X 追加超级

发布于 2024-08-10 04:28:13 字数 387 浏览 2 评论 0原文

在我的类中,当编写 toString() 方法时,我总是使用来自 org.apache.commonsToStringBuilder

并且当我扩展其他类时,我使用 appendSuper( ) 然后我的appends

问题:

这样做是否有任何真正的差异:

appendSuper(super.toString())

而不是

append(super.toString())

某种虚拟问题。

干杯

in my classes when writing the toString() method I always use the ToStringBuilder from org.apache.commons

And when I'm extending other classes I use appendSuper() and then my appends

The question:

Are there are any real differences in doing:

appendSuper(super.toString())

instead of

append(super.toString())

Kind of dummy question.

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别闹i 2024-08-17 04:28:13

appendSuper 是从 追加。 Apache commons lang 2.4 的任何实现都没有做到这一点。

A ToStringStyle implementation can render it differently when appendSuper is called from append. No implementation of Apache commons lang 2.4 does it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文