简体   繁体   English

javadoc方法中的变量类型eclipse

[英]Variable type in javadoc methods eclipse

Is there a way to have the type of the input variable for methods with javadoc in eclipse? 有没有办法在eclipse中使用javadoc的方法获得输入变量的类型?

I know you can have as tags the name of the variables like: 我知道你可以将变量的名称作为标签:

/*
* param1
* param2
*/

But I'd like something like: 但我喜欢这样的东西:

/*
* String param1:
* int param2:
* return int: 
*/

I've seen in Window-->Preferences->Java-->Code Style-->Code Templates but I can't see anything resembling the tags I need. 我在Window - > Preferences-> Java - > Code Style - > Code Templates中看到过,但我看不到任何类似我需要的标签。

Thanks 谢谢

No, the javadoc tool does not support this. 不, javadoc工具不支持此功能。

Why would you want this? 你为什么要这个? In the documentation of a method that you generate with javadoc, the method signature already shows what the types of the parameters are. 在使用javadoc生成的方法的文档中,方法签名已经显示了参数的类型。

What about the following comment template - as far as I can see, this is exactly what you want :-) 以下评论模板怎么样 - 据我所知,这正是你想要的:-)

/**
 * ${field_type} ${field}
 */

EDIT : Use the above template in Window >> Preferences >> Java >> Code Style >> Code Templates for Comments >> Fields 编辑 :在窗口>>首选项>> Java >>代码样式>>注释的代码模板>>字段中使用上述模板

代码模板首选项页面

Now you can use the command Generate Element Comment ( Ctrl + Alt + J (I think) or Command + Alt + J on Mac) with the cursor on an field to generate the correct comment. 现在,您可以使用命令生成元素注释(在Mac上为Ctrl + Alt + J (我认为)或Command + Alt + J ),并在字段上使用光标生成正确的注释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM