views:

405

answers:

4

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?

+1  A: 

You would have to write your own Doclet.

Software Monkey
A: 

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.

Juha Syrjälä
This reminds me of a DailyWTF entry http://forums.thedailywtf.com/forums/p/3616/88501.aspxUsers will NOT listen when the documentation warns them not to use something. It's sad but true.
Chris Nava
A: 

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

mhaller
Thanks. But what I want is to exclude methods, not classes. I think this tool only enables excluding classes. Any other idea?
snakile
Download and change it. It's an example (click the example link). Else, try http://developer.berlios.de/projects/padoclet/
mhaller
+2  A: 

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

atk
Looks like this is the right way to go to me. It seems to be a bug in javadoc though that the java @Deprecated annotation does not cause the method to be excluded, you must use the @deprecated tag in the javadoc for the method.
Geoff Reedy
I think this is my answer. I'm not around my computer so I'll check it tomorrow and probably accept you answer. Thanks.
snakile
+1: When I answered he had not said why he wanted to exclude the methods, or I would have suggested the same thing.
Software Monkey