如何配置Intellij Idea javadoc模板? [英] How configure Intellij Idea javadoc templates?
问题描述
我有一些方法:
public int getSomeField()
我想生成这样的javadoc:
I want to generate javadoc like this:
/**
* Gets {someField}
*
* @return value of {someField}
*/
其中{someField}是字段名称的占位符。可以为Intellij Idea创建这个模板(可以作为实时模板)?
Where {someField} is placeholder for field name. It is possible to create this templates for Intellij Idea (may be as live template)?
推荐答案
打开Generate菜单(Cmd Mac上为+ N,Windows上为Alt + Insert)
Bring up the Generate menu (Cmd+N on Mac, Alt+Insert on Windows)
点击右上角的省略号。
单击左上角的加号并创建一个新模板。
Click the plus in the top left corner and create a new template.
将旧模板的内容复制到新模板中,并将以下行添加到顶部它。
Copy the contents of the old template into the new template and add the following lines to the top of it.
/**
* Gets $field.name
*
* @return value of $field.name
*/
现在,当你生成getter时,使用'New Template',你应该得到你的getter with JavaDoc。
Now when you generate the getter use the 'New Template' and you should get your getter with the JavaDoc.
这篇关于如何配置Intellij Idea javadoc模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!