aspose file tools*
The moose likes Java in General and the fly likes How to properly structure method JavaDoc comment format using Doclet API  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to properly structure method JavaDoc comment format using Doclet API  " Watch "How to properly structure method JavaDoc comment format using Doclet API  " New topic
Author

How to properly structure method JavaDoc comment format using Doclet API

Michael K. Wilson
Ranch Hand

Joined: Apr 23, 2008
Posts: 45
Wrote a custom doclet using the Doclet API.

The purpose for the doclet is to load Java source files and create stubs (which are identical Java source files but do not contain any method implementation details).

Need the JavaDoc comments (located inside the newly created stub source file) to be properly formatted / match the format with the original source file using this doclet that I created...

Here's my doclet:



For example, lets say I run it against this target source file:



The newly created Java source file's JavaDoc looks like this:



Notice how with the exception of the first line, the second line and subsequent lines are pushed to the left side of the screen and don't containing leading asterisks before them...

This is definitely some type of weird formatting issue...

What am I possibly doing wrong?

Is there any easier way to correctly format the JavaDoc comments to match the target source file which is loaded by MyDoclet?

Should I be using the com.sun.javadoc.SourcePosition.line() or com.sun.javadoc.SourcePosition.column() methods?

Happy programming,

Mike
Taariq San
Ranch Hand

Joined: Nov 20, 2007
Posts: 192
Put a breakpoint at method.commentText() and inspect that value, I suspect it contains the entire comment, and you then print it all on one line....



You're not looping through a list of lines in the file, what you might consider doing is splitting that text with String's split method, pass it the new line character and print the TAB plus an asterisk for each line and then close the comment.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to properly structure method JavaDoc comment format using Doclet API