$body

Figure 1: Javadoc Tool API.
JavaDocTool
JavaDoc Tool is a custom tool class used for creating a Document node.
- create() - Return a new instance of a Document node. Each JavaDoc comment must start with /** and ended with */.
- createForText() - Return a new instance of a Document node. This method allows in-complete JavaDoc (comments without /** and */) to be loaded with JavaDocTool.
Document
Document is an interface representing a Comment Document.
- getRawComment() - Return the full unprocessed text of the comment.
- getTags() - Return all tags in this document item.
- getTags(tagName : String) - Return a tag of the specified kind of this document item.
- get(tagName : String) - Return a tag of the specified kind of this document item. If any tags with the same kind are found, the first tag of that kind will be returned.
DocumentImpl
DocumentImpl is a default JavaDoc document implementation.
- getComment() - Return formatted text for this document.
- getInlineTags() - Return comment as a collection of tags.
- getFirstSentenceTags() - Return the first sentence of the comment as a collection of tags.
Tag
Tag is an interface representing a simple documentation tag, such as @since, @author, and @version
- getKind() - Return the kind of this tag.
- getText() - Return the text of this tag.
- getInlineTags() - Return a collection of tags for a documentation comment with embedded {@link} tags.
TagImpl
TagImpl is a default tag implementation.
- getRawText() - Return the full unprocessed text of this tag.
- toString() - Return the text of this tag. Usually calls getText().
ParamTag
ParamTag represents a @param documentation tag.
- getName() - Return the name of the parameter associated with this tag.
- getComment() - Return the parameter’s comment.
ThrowsTag
ThrowsTag represents a @throws or @exception documentation tag.
- getName() - Return the name of the exception associated with this tag.
- getComment() - Return the exception’s comment.
SeeTag
SeeTag represents a user-defined cross-reference to related documentation. The reference can be either inline with the comment using {@link} or a separate block comment using @see.
- getLabel() - Return the label of the @see tag.
- getReference() - Return the MODEL or URL of the @see reference.
- getLink() - Return the Link object representing this tag.
SerialFieldTag
SerialFieldTag represents a @serialField tag.
- getFieldName() - return the serial field name.
- getFieldDescription() - return the field comment.
- getFieldType() - return the field type string.
For examples:
- Import the Javadoc tool and create an instance of Javadoc document:
#import ("javadoc", "com.nomagic.reportwizard.tools.doc.JavaDocTool") #set ($doc = $javadoc.create($comment))
- Print a Javadoc comment:
$doc.comment
- Print the first encountered author:
$doc.author
- Print all authors:
#foreach ($author in $doc.getTags("author")) $author.text #end
- Print the first sentence:
#foreach ($tag in $doc.firstSentenceTags) $tag.text #end
- Print the inline tags:
#foreach ($tag in $doc.inlineTags) $tag.kind $tag.text #end
- Print a raw comment (plain text without a document parser or HTML renderer):
$doc.rawComment
- Print all block tags:
#foreach ($tag in $doc.tags) $tag.kind : $tag.text #end
- Print all param tags:
#foreach ($tag in $doc.getTags("param")) $tag.name - $tag.comment #end
- Print all throws tags:
#foreach ($tag in $doc.getTags("throws")) $tag.name - $tag.comment #end
- Print all see tags:
#foreach ($tag in $doc.getTags("see")) $tag.label - $tag.reference #end
Reference Documents
- Javadoc specification
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#javadoctags - Writing Javadoc
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html - Javadoc Tool API
<install.dir>/plugins/com.nomagic.magicdraw.reportwizard/api/javadoc.zip
On this page