|
| 1 | +# CodeGenerator |
| 2 | +An idea-plugin for code generation, support template customization. |
| 3 | + |
| 4 | +// TODO: add demo |
| 5 | + |
| 6 | +As we know, Intellij had provided useful code generators such as constructors, |
| 7 | +getter/setters, equals, hashCode, overrides and delegates, etc. And Intellij |
| 8 | +allows us to apply customized velocity templates for each generator. But we |
| 9 | +cannot add our own generators. |
| 10 | + |
| 11 | +Code Generator is here to help. Two types of generation are supported here |
| 12 | +- Members(fields/method) based templates, such as serializers, equals, etc. |
| 13 | +- Class based template, such as transformers, converters, etc. Normally new classes are created. |
| 14 | + |
| 15 | +# Installation |
| 16 | + |
| 17 | +1. Search `CodeGenerator` in Idea plugins |
| 18 | +2. Download zip from from [Releases](https://github.com/lotabout/CodeGenerator/releases) |
| 19 | + |
| 20 | +To install a plugin from the disk in idea: |
| 21 | + |
| 22 | +1. Open the `Settings/Preferences` dialog box and select `Plugins` on the left pane. |
| 23 | +2. On the right pane of the dialog, click the `Install plugin from disk` button. |
| 24 | +3. Select the location of the zip file, click OK to continue. |
| 25 | +4. Click `Apply` button of the Settings/Preferences dialog. |
| 26 | +5. Restart IntelliJ IDEA to activate. |
| 27 | + |
| 28 | +# Usage |
| 29 | + |
| 30 | +1. Go to the `Settings/Preferences > Other Settings > CodeGenerator` to |
| 31 | + create a new generator/template. |
| 32 | +2. Right click on your java file, Select `Generate > CodeGenerator > [name of |
| 33 | + your generator]` to run the generator. |
| 34 | + |
| 35 | +According to the settings of your generator, there might be dialogs show up |
| 36 | +asking to select members or classes that's required by your generator. |
| 37 | + |
| 38 | +# Thanks to |
| 39 | +- [CodeMaker](https://raw.githubusercontent.com/x-hansong/CodeMaker): where |
| 40 | + the idea and part of code comes from. |
| 41 | +- [generate-tostring](https://github.com/JetBrains/intellij-community/tree/master/plugins/generate-tostring): |
| 42 | + Offical toString generator. Part of the code comes from it. |
| 43 | + |
0 commit comments