• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to add comments for a Package to generate Javadoc?  RSS feed

 
Raj S Kumar
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to add descriptions about a Package in the Javadoc. Is there any way to include it as comment in the Source code itself instead of the package.html way?

Your suggestions please......

Thanks in advance..........
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See http://java.sun.com/j2se/javadoc/writingdoccomments/index.html for all you need to know about all kinds of Javadocs comments.
 
Raj S Kumar
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya, I read that Ulf. It asks me to create a package.html file. I want to check whether any other way is possible to specify them as comments in the source code itself.
If there is no other alternative, I should go for the html way.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seeing how package comments are independent of any particular class, keeping them in the source code wouldn't make much sense.
 
Raj S Kumar
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf.

I have some private members (variables) in a class. is there a way to define it only once as part of a class?
In the Sun link, it has been specified as '@param' is only for methods and constructors.

any suggestions Ulf..........
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each member should get its own Javadoc block.

By the way, that page is a bit outdated. Java 5.0 added support for package-info.java files:
package-info.java: You can now create a source file with this name to store package comments and annotations. It can be used in place of package.html (which supports only comments, not annotations). If package-info.java is present, javadoc should ignore package.html and look instead for the package doc comment immediately preceding the (possibly annotated) package declaration. The javadoc tool handles the selection and parsing of package-info.java and package.html and passes the doc comments to the doclet.

That doesn't mean you shouldn't use package.html, it just means you have a more powerful alternative.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!