Eclipse Photon finally ships with a toString() template configurator.
Sadly, this dialog has some major limitations: It is not possible to configure the templates as freely as you like. Instead, they will be checked for type safety. This brings along another restriction: The selected builder class needs to have a public constructor with a single object (or string) argument. Yikes!
I have no clue, why someone had the idea that a builder class needs to have a public constructor with a single object argument. Instead, IntelliJ IDEA shows us how it’s done correctly: You can freely insert any Java Code you like, including nested conditions:
As you can see, IntelliJ has no such restrictions. It is very easy to include such a template. I waited for more than 10 years for eclipse to ship a template configuration dialog for toString() methods. Now it’s here. But it does not help much.
IntelliJ StringJoiner Template for toString() methods
By the way: The template you can see in above screenshot can be found right here on Github as gist.