1
I’m refactoring a code that uses the eclipse plug but I want to turn it into pure java. The idea is to transform String into something with this style:
Person@182f0db
[
name=John Doe
age=33
smoker=false
]
Current code is using libraries org.apache.commons.lang3.builder.ToStringBuilder
and org.apache.commons.lang3.builder.ToStringStyle
:
ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
What pure java library can I do just that? I know you have one StringBuilder
but I don’t know a method to do the same.
Stringbuilder will do nothing you look for, it is used to concatenate strings. It’s strange that you want a library to do this solution for you. It wouldn’t be easier to write the
@toString()
?– Gustavo Cinque
Related (or duplicate): Questions about the toString() method of the Object class Ask a question vote in favor
– user28595
Related: Print arraylist information on the screen and How do I display what’s inside the list?
– user28595