如何配置 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)?
推荐答案
调出生成菜单(Mac 上为 Cmd+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 时,请使用新模板",并且您应该使用 JavaDoc 获取您的 getter.
Now when you generate the getter use the 'New Template' and you should get your getter with the JavaDoc.
这篇关于如何配置 Intellij Idea javadoc 模板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!