java - .jd 文件到底有什么用?

标签 java html javadoc

我在工作中一直在使用 .jd 文件,在本地计算机中构建它以将其转换为 html...

但是,我仍然对 .jd 文件的用途感到困惑?我做了一些研究,定义是:“Javadoc 是一个从代码中的 Javadoc 注释生成 html 文档(类似于 java.sun.com 的引用页)的工具。”

当我查看 .jd 文件代码时,它们看起来非常像 html。他们有<p>标签和 <li>标签。程序员写javadoc代码吗?或者Javadoc是一个从Java代码中提取注释的工具(这对我来说很模糊,一个名为Javadoc的生成.jd文件的软件工具?)?

有人可以帮我理解吗?由于我没有直接生成 .jd 文件,因此很难理解它的用途以及它到底是什么......

非常感谢!

最佳答案

JavaDoc 由开发人员编写,并在其源代码中嵌入注释。

例如:

/**
 * Returns an Image object that can then be painted on the screen. 
 * The url argument must specify an absolute {@link URL}. The name
 * argument is a specifier that is relative to the url argument. 
 * <p>
 * This method always returns immediately, whether or not the 
 * image exists. When this applet attempts to draw the image on
 * the screen, the data will be loaded. The graphics primitives 
 * that draw the image will incrementally paint on the screen. 
 *
 * @param  url  an absolute URL giving the base location of the image
 * @param  name the location of the image, relative to the url argument
 * @return      the image at the specified URL
 * @see         Image
 */
 public Image getImage(URL url, String name) {
        try {
            return getImage(new URL(url, name));
        } catch (MalformedURLException e) {
            return null;
        }
 }

此示例记录了一个名为 getImage 的方法。

JavaDoc 很棒,因为它是开发人员可以在代码旁边编写代码的文档,并且在运行生成器后,他们拥有其他人可以轻松阅读的良好技术文档。

您在 .jd 文件中看到 html 的原因是由于格式原因,一些 html 可以嵌入到 JavaDoc 中(请参阅示例)

关于java - .jd 文件到底有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34141780/

相关文章:

html - Bootstrap 对齐 - 导航标题对齐

javascript - Phonegap,停止音频

java - 使用子类时拆分 Hibernate 配置文件(hbm.xml 文件)

java - 在表中查找 JSON/部分 JSON

java - 下载文件而不知道其大小

java - 有没有办法在在线编译器中创建 JFrame?

php - htaccess "breaks"包含 HTTP 451 的参数

Eclipse - 强制 Javadoc 悬停在有警告的元素上

maven - 由于 Javadoc 错误而无法构建 Maven 项目?

android - 如何使用 Intellij IDEA 中的 UMLGraph 创建 javadoc