• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JavaDoc Question

 
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 ]
 
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 ]
 
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 ]
 
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?
 
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic