I have a little trick for Objects.toStringHelper(). I configured IntelliJ IDEA to use it when auto-generating toString() methods. I assume you can do the same in Eclipse. Here's how to do it in Intellij: go inside a class hit Alt + Insert to popup the "Generate" menu choose toString() click the "Settings" button go to the "Templates" tab create a new template named "Guava's Objects.toStringHelper()" (I did it by copying the "ToStringBuilder" template) change the template to: public String toString() { #set ($autoImportPackages = "com.google.common.base.Objects") return Objects.
Read full article from java - Using Google Guava's Objects.ToStringHelper - Stack Overflow
No comments:
Post a Comment