如何从 Javadoc 中排除已弃用的公共方法?

发布于 2024-08-18 06:11:47 字数 348 浏览 5 评论 0原文

我想为我的课程生成 javadoc。 “生成 Javadoc”命令为我提供了一个选项,可以为具有私有/包/受保护/公共可见性的成员创建 Javadoc。 但有一些公共方法我不想包含在 Javadoc 中。 如何为此 Javadoc 生成器准确指定要包含哪些成员/方法以及不包含哪些成员/方法?

(我使用 eclipse 3.4.2)

编辑: 你们中有些人问我想这样做的原因是什么。原因是我有一些我不希望存在的方法,但我仍然需要它们来实现向后兼容性。我将它们标记为@deprecated,以便尝试使用它们的人会收到警告。但我根本不希望它们出现在 Javadoc 中。有没有办法将它们从 javadoc 中排除,因为它们被标记为@deprecated?

I would like to generate javadoc for my classes.
The 'generate Javadoc' command gives me an option to create Javadoc for members with visibility Private/Package/Protected/Public.
But there are some public methods I don't want to be included in the Javadoc.
How can I specify for this Javadoc generator exactly which members/methods to include and which ones to not include?

(I use eclipse 3.4.2)

Edit:
Some of you asked what is the reason I want to do this. The reason is that I have some methods which I don't want to exist but I still need them to work for backward compatibility. I marked them as @deprecated so that people who try to use them will recieve a warning. But I don't want them to appear at all in the Javadoc. Is there a way to exclude them from the javadoc given they're marked @deprecated?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

垂暮老矣 2024-08-25 06:11:47

那么,为什么 javadoc -nodeprecated 没有做到这一点?

So, why does javadoc -nodeprecated not do the trick?

夜唯美灬不弃 2024-08-25 06:11:47

您必须编写自己的 Doclet

You would have to write your own Doclet.

残龙傲雪 2024-08-25 06:11:47

因此,您有一些由于某种原因必须公开的方法,但类用户不应该真正搞乱这些方法吗?

您可以将这种 JavaDoc 用于那些“隐藏”公共方法:

 /**
  * !!! THIS METHOD IS NOT PART OF PUBLIC INTERFACE !!!
  * !!! DO NOT USE !!!
  */
 public void somethingThatShouldNotBeUsedByOutsiders()

我快速浏览了一下,似乎没有办法至少通过标准 JavaDoc 工具

So you have some methods that must be public for some reason, but are something that class users should not really mess with?

You could put this kind of JavaDoc for those "hidden" public methods:

 /**
  * !!! THIS METHOD IS NOT PART OF PUBLIC INTERFACE !!!
  * !!! DO NOT USE !!!
  */
 public void somethingThatShouldNotBeUsedByOutsiders()

I took a quick glance and there seems to be no way to do method level exclusions at least via the standard JavaDoc tools.

很酷不放纵 2024-08-25 06:11:47

正如 Software Monkey 所写,您可能必须编写自己的 Doclet。
有一个 示例 几乎可以完成您想要的操作,排除Doclet

As Software Monkey wrote, you probably have to write your own Doclet.
There's an example which does nearly what you wanted, the ExcludeDoclet

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文