Download IDEA CodeMaker: A Tool for Simplifying Java Plugin Generation
The main function
- Support for adding custom code templates (Velocity)
- Support for selecting multiple classes as the context for code templates
Installation
- Open the settings, select “Plugin”
- In the right box, click “Install plugin from disk”
- Select the above to download the “CodeMaker.zip“
- Then Click Apply, and then restart IDEA.
Usage
In the Java class editing interface, right-click “Generate,” select the corresponding template to automatically generate code for the current class in the package, and then modify and move it to the appropriate location.
IDEA CodeMaker settings
The code template requires a class other than the current class as the context, which you can select through the class selection box.
IDEA Java plugin
Currently, it comes with two templates:
- The Model: Generates a class with properties similar to the current class for automatically creating persistent classes corresponding to domain classes.
- Converter: This template requires two class contexts as input for the automatic generation of domain classes with lasting transformation classes.
The above two templates are my own work in commonly used templates. You can refer to their wording and create your own code templates.
Template Configuration
- To Increase Template: Click “Add Template” after filling in the relevant configuration (can be null). IDEA needs to restart to take effect, then click Save.
- Delete Template: Click “Delete Template” to delete the template, and it also requires a restart to take effect.
- The Template Name: In the Build menu, display the name (English name).
- The Class Number: The template requires input context class number. For example, if 1, the current class is input as
$class0
. If 2, it requires the user to select a class as input:$class0, $class1
. - The Class Name: The name of the class generated, configured through Velocity. The context is the same as code templates.