Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto generate toString method in a lot of entities

I got a lot of entities, 160 to be specific. I need to override toString method in all of them. My question is: Is there some shortcut on Intellij or some external tool where I can auto generate toString method in all of those entities?

like image 879
KiKo Avatar asked Oct 17 '22 21:10

KiKo


1 Answers

In Intellij i supposed it can be done like this :

  1. Open the desired class for editing and do one of the following:

    • On the main menu, choose Code | Generate.
    • Right-click the editor and choose Generate on the context menu
    • Press Alt+Insert.
  2. From the pop-up list that shows up, select toString() option. Generate toString() wizard displays the list of fields in the class.

In eclipse it could be done aswell :

  1. Right click the editor
  2. Select Source
  3. Then Select generate toString().
  4. Then select all the fields you want.
like image 58
Karl Alexander Avatar answered Nov 11 '22 15:11

Karl Alexander