Android Studio中的Javadoc @link参考以build.gradle [英] Javadoc @link references in Android Studio to build.gradle

查看:330
本文介绍了Android Studio中的Javadoc @link参考以build.gradle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,这不是重复的问题。这个问题的灵感来自对这篇文章的评论。

First of all, this is not a duplicate question. This question is inspired by the comment on this post.

我知道如何在Android Studio中执行Javadoc注释。而且我能够使用@link这样链接Java文件:

I know how to do Javadoc comments in Android Studio. And I am able to link java files using @link like this:

{@link FileName#methodName()} some text to display

但是我无法找到链接 build.gradle 文件。我之所以需要此,是因为我们将 buildConfigField 存储在Gradle文件中,如下所示:

but I am not able to figure out a way to link build.gradle file in the comments. The reason why I need this that we are storing buildConfigField in the Gradle file like this:

 buildTypes.each {
    it.buildConfigField('int', 'LANGUAGE_VERSION', "3")
}

我对文件进行评论,以确保每次文件中有任何更改时都升级此版本号。在文件上写下Java注释时,我遇到了这种情况。有没有办法链接文件?

I was commenting on the file that makes sure to upgrade this version number every time whenever there is something changed in the file. And while writing down java comments on the file I faced this situation. Is there a way to link the file?

推荐答案

您可以尝试在javadoc注释中给出build.gradle的绝对路径。通过使用HTML链接标记

You can Try giving the absolute path to your build.gradle in your javadoc comments by using HTML link tag

/**
 *  <a href="./path to build.gradle/build.gradle">Link</a>  
 */

Oracle Description关于在Javadoc中包含文件的说法:

What Oracle Description says about including files in Javadoc:

您还可以在源代码中包含希望Javadoc工具复制到目标目录的任何其他文件。这些文件通常包括图形文件,示例Java源(.java)和类(.class)文件,以及独立的HTML文件,其内容会淹没普通Java源文件的文档注释。
要包含未处理的文件,请将它们放在名为doc-files的目录中,该目录可以是任何包含源文件的软件包目录的子目录。每个软件包都可以有一个这样的子目录。您可能包括图像,示例代码,源文件,.class文件,applet和HTML文件。例如,如果要将按钮button.gif的图像包含在java.awt.Button类文档中,则可以将该文件放在/ home / user / src / java / awt / doc-files /目录中。请注意,doc文件目录不应位于/ home / user / src / java / doc-files,因为java不是软件包,也就是说,它不直接包含任何源文件。

You can also include in your source any miscellaneous files that you want the Javadoc tool to copy to the destination directory. These typically includes graphic files, example Java source (.java) and class (.class) files, and self-standing HTML files whose content would overwhelm the documentation comment of a normal Java source file. To include unprocessed files, put them in a directory called doc-files which can be a subdirectory of any package directory that contains source files. You can have one such subdirectory for each package. You might include images, example code, source files, .class files, applets and HTML files. For example, if you want to include the image of a button button.gif in the java.awt.Button class documentation, you place that file in the /home/user/src/java/awt/doc-files/ directory. Notice the doc-files directory should not be located at /home/user/src/java/doc-files because java is not a package -- that is, it does not directly contain any source files.

到这些未处理文件的所有链接都必须经过硬编码,因为Javadoc工具不会查看文件-它只是将目录及其所有内容复制到目标位置。例如,Button.java文档注释中的链接可能类似​​于:

All links to these unprocessed files must be hard-coded, because the Javadoc tool does not look at the files -- it simply copies the directory and all its contents to the destination. For example, the link in the Button.java doc comment might look like:

/**
 * This button looks like this:
 * <img src="doc-files/Button.gif">
 */ 

这篇关于Android Studio中的Javadoc @link参考以build.gradle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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