Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaDoc Question

 
Stef Widmer
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers

My assignment tells me to 'Javadoc' every element of the public interface of each class.

In the code snippet below I create an annonymous class (new WindowAdapter) containing the public method windowClosing (which is specified by the interface WindowListener)

My question is as follows:
Do I have to add a Javadoc comment for "public void windowClosing(WindowEvent we)" or is it legal to omit the Javadoc comment?



Thanks for any answers.
Cheers Stef
[ August 25, 2004: Message edited by: Stef Widmer ]
 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stef,
My question is as follows:
Do I have to add a Javadoc comment for "public void windowClosing(WindowEvent we)" or is it legal to omit the Javadoc comment?

No. You don't need to javadoc anonymous inner classes. Matter of fact, I think you even can't.
Anonymous inner classes are local to the methods, hence they are not available to anyone else, even to the methods in the same class. Think about it, what is the use of the documentaion if no one else can use it...!!
[ August 25, 2004: Message edited by: Hanna Habashy ]
 
mike acre
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually this question is better asked regardless of any annoymous factor.

If an inner class is not public or protected then the default javadoc visibilty argument will not show your inner class in the docs.

I have inner classes that implement interfaces, so there method signatures are public. The interface is documented, but I haven't even written a comment of any kind against the implementations, since they are self documenting. The inner class is private and only the interface type is made visible to clients via a factory method which is well documented.
 
Stef Widmer
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ranchers, I felt so too (a little bit), but it's good to have other optinions to get the feeling I'm doing it right.

Thanks all...
Cheers Stef
[ August 25, 2004: Message edited by: Stef Widmer ]
 
Yanxin Zhao
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone:
what kind of classes are need to write javadoc comment in my application?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic