开发者

How to exclude deprecated public methods from Javadoc?

开发者 https://www.devze.com 2022-12-17 06:12 出处:网络
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.

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?


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


You would have to write your own Doclet.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消