有什么方法可以在 Eclipse 中自动生成所有 Javadoc 注释? [英] Any way to auto generate ALL Javadoc comments in Eclipse?

查看:38
本文介绍了有什么方法可以在 Eclipse 中自动生成所有 Javadoc 注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以按 shift+alt+j 为当前代码块插入一个合适的注释模板,但是有没有什么办法让 eclipse 发疯并像这样做一个完整的项目?

I know that you can press shift+alt+j to insert an appropriate comment template for the current code block, but is there any way to let eclipse just go crazy and do a whole project like this?

推荐答案

对于整个项目,可能不是,但你至少可以:

For a whole project, may be not, but you can at least:

  • 转到包资源管理器视图
  • 展开你想要生成评论的类(打开每个方法)
  • 从包资源管理器树中选择类中所有打开的元素
  • alt+shift+J 和瞧:在类和每个方法上生成的注释
  • go to the Package Explorer View
  • expand the class you want to generate comment on (open each method)
  • select all the opened elements in the class from that Package Explorer Tree
  • alt+shift+J and voilà: comments generated on the class, and every method

不适合所有项目的唯一原因是:

The only reason it is not practical for the all project is:

  • 您需要打开每个要在其上发表评论的课程
  • 在对第一组方法进行注释后,如果您编写了新方法,仍然需要重复该过程.

话虽如此,另一种方法在文章Javadoc 不完整问题",2010 年 3 月 30 日,提倡扩展 Javadoc 视图.

That being said, another approach is described in the article "The Problem of Incomplete Javadocs" from March, 30th 2010, advocating for an extended Javadoc view.

扩展的 Javadoc 视图本质上是单个代码元素(如类、方法、字段或参数)的不同信息源的聚合器.它旨在替代现有的 Eclipse Javadoc.

The extended Javadoc View is essentially an aggregator of different information sources for a single code element like a class, method, field or parameter. It is designed as a replacement for the existing Eclipse Javadoc.

有趣的部分来自视图中的其他选项卡:子类指令和子类模式.
这些选项卡包含有关开发人员通常如何扩展所选代码元素的挖掘信息.

The interesting part comes with the other tabs in the view: Subclassing Directives and Subclassing Patterns.
These tabs contain mined information about how developers typically extended the selected code element.

  • 子类化标签:
  • 子类指令是对示例代码中经常出现的观察结果的概括,例如Wizard 的子类总是覆盖其方法 addPages()"或Reimplementors of Dialog.createContents() 可以调用它的超级实现".

    subclassing directives are generalizations of frequently made observations in example code like "Subclasses of Wizard always override its method addPages()" or "Reimplementors of Dialog.createContents() may call its super implementation".

    • 子类化模式选项卡

    子类模式尝试将观察到的基类扩展分组为典型的扩展模式,即它们通过相似性对子类进行聚类以在数据中找到模式.

    Subclassing patterns try to group observed extensions of a base class into typical extension patterns, i.e., they cluster subclasses by similarity to find patterns in data.

    这篇关于有什么方法可以在 Eclipse 中自动生成所有 Javadoc 注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆