I have a java bean with many fields. I have know how to override toString() using StringBuilder and directly using field names. Is there any way to do it in better way like, without field names?
Thanks in advance.
P.S: this bean is already implemented in my product.
I often use Apache Common Lang’s
ToStringBuilderlike so:This uses reflection to generate a
toStringfor the object in question.