Idea custom method annotation template

  1. Open Preferences, click Live Templates, first add a Template Group, named Define, the results are as follows:
    Insert picture description here
  2. Select the Define that you just created, choose to add Live Template, and then add the following information to the Template. The Abbreviation attribute is very important. You need to use this value when you annotate the method, so don't write too complicated, simpler is best, and then Template Text is the template format customized by the annotation method:
    Insert picture description here
  3. After completing the above information, click the fifth step and select java as follows:
    Insert picture description here
  4. Finally, select the operation to trigger the custom template, usually using the Enter key, so click Expand with and select the Enter option, as follows:
    Insert picture description here
  5. Finally, configure the parameter value expression in the lower template, click Edit variables, and maintain the expression as follows:
    Insert picture description here

Finally select apply to make the configuration take effect.

Test the effect:

On one method, enter **/ a as follows:
Insert picture description here

Click Enter, and the result is as follows:
Insert picture description here
You can find that the custom comment is effective. The following provides a reference template:

(此处注意留空一行)
* @Description: TODO
* @Param: $param$
* @Return: $return$ 
* @Author: 用户名
* @Date: $time$
**/

Guess you like

Origin blog.csdn.net/weixin_38106322/article/details/111187140