javadoc @hide无法正常工作 [英] javadoc @hide can't work

查看:77
本文介绍了javadoc @hide无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据链接,我写道以下代码:

According to the link, i wrote the following code:

/**
 * @hide
 * */
public void myMethod() {
    // do something
}

当我使用命令生成文档时:

When i use the command to generate the doc:

$ javadoc -locale en_US -encoding UTF-8 -charset UTF-8 -d doc xxx.java

该文档仍然具有 myMethod 项目.那么如何隐藏 myMethod ?我想念什么?

The doc still have the myMethod item. So how to hide the myMethod? What did i miss ?

推荐答案

您正在使用 Doclava标记,但正在使用标准doclet生成API文档.

You are using a Doclava tag, but are generating the API documentation using the standard doclet.

构建Doclava

Doclava 与一个蚂蚁脚本捆绑在一起以构建doclet."jar"任务将构建一个包含Doclava和所有必要依赖项的jar.

The Doclava source comes bundled with an ant script to build the doclet. The "jar" task will build a jar containing Doclava and all necessary dependencies.

在Javadoc中使用Doclava

传递给Javadoc以使用Doclava的命令行参数为: -doclet com.google.doclava.Doclava -docletpath $ {jar.file}

The command line arguments to pass to Javadoc to use Doclava are: -doclet com.google.doclava.Doclava -docletpath ${jar.file}

根据官方 Javadoc常见问题解答,目前无法直接隐藏公开成员.

As per the official Javadoc FAQ, hiding public members is currently not possible in a direct way.

有时,您可能需要将类或方法公开,以便可以从其他包中访问它,而不是因为您希望使其成为公共API的一部分.在文档中出现这些方法只会使应用程序开发人员感到困惑.

Occasionally you might need to make a class or method public so that it can be accessible from other packages, not because you want it to be part of the public API. Having these methods appear in the documentation merely confuses application developers.

当前没有Javadoc选项可以从javadoc生成的文档中隐藏,排除或禁止公共成员.

There is currently no Javadoc option to hide, exclude or suppress public members from the javadoc-generated documentation.

有几个选项:

  • 排除源文件-您可以仅将要记录的所有类的源文件名传递到javadoc中,并排除要忽略的类.请注意,这具有文件而不是类的粒度.因此,如果排除包含嵌套类的源文件,则它们也将被排除.(您可以将类列表放在命令中行参数文件,而不是直接在命令行上输入.)在命令行上传递包名称时,默认的Javadoc无法忽略类.
  • 排除单个类-您可以使用排除Doclet .与上一个选项相比,它具有更好的粒度(类而不是源文件),并且使用起来更自然,因为您在文件中明确列出了要排除的文件.
  • 排除类,方法和字段- yDoc Doclet 具有此功能,您可以在源代码中用排除标记标记项目.此外,欢迎任何人将上面的排除Doclet"扩展为方法和字段-我们很乐意发布它,并将您的姓名添加到功劳中.
  • Excluding source files - You can pass into javadoc only the source filenames for all classes you want to document, and exclude those you want to omit. Notice this has the granularity of files, not classes. Therefore, if you exclude a source file that contains nested classes, they would also be excluded. (You can put the list of classes in a command line argument file rather than directly on the command line.) The default Javadoc offers no way to omit classes when passing in package names on the command line.
  • Excluding individual classes - You can use the Exclude Doclet. This has finer granularity (class rather than source file) than the previous option, and would be more natural to use because you explicitly list in a file the files you want to exclude.
  • Excluding classes, methods and fields - The yDoc Doclet has this capability, where you mark items with an exclusion tag in the source code. In addition, anyone is welcome to extend the Exclude Doclet above for methods and fields -- we'd be happy to publish it and add your name to the credits.

我们正在考虑将@exclude作为排除成员的建议标签.

We are considering @exclude as a proposed tag for excluding members.

还请查看建议的Javadoc标签"页面有关更多信息,请访问 @exclude @hide .

Also check out the Proposed Javadoc Tags page for more info into @exclude and @hide.

这篇关于javadoc @hide无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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