如何从 Javadoc 中排除已弃用的公共方法?
我想为我的课程生成 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
那么,为什么
javadoc -nodeprecated
没有做到这一点?So, why does
javadoc -nodeprecated
not do the trick?您必须编写自己的 Doclet 。
You would have to write your own Doclet.
因此,您有一些由于某种原因必须公开的方法,但类用户不应该真正搞乱这些方法吗?
您可以将这种 JavaDoc 用于那些“隐藏”公共方法:
我快速浏览了一下,似乎没有办法至少通过标准 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:
I took a quick glance and there seems to be no way to do method level exclusions at least via the standard JavaDoc tools.
正如 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