NEW RELEASE! The 2022x Refresh2 Hot Fix 3 was released on February 28, 2025. For more information, see 2022x Refresh2 Hot Fix 3 Version News.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Content layer
id133358159
Content column
id133358160
Content block
id133358157

On this page

Table of Contents
maxLevel34
minLevel23

Content block
id133358160
Javadoc Tool API
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:  
Code Block
languagetext
#import ("javadoc",
"com.nomagic.reportwizard.tools.doc.JavaDocTool")
#set ($doc = $javadoc.create($comment))
  • Print a Javadoc comment:
Code Block
languagetext
$doc.comment
  • Print the first encountered author:
Code Block
languagetext
$doc.author
  • Print all authors: 
Code Block
languagetext
#foreach ($author in $doc.getTags("author"))
$author.text
#end
  • Print the first sentence:
     
Code Block
languagetext
#foreach ($tag in $doc.firstSentenceTags)
$tag.text
#end
  • Print the inline tags:
Code Block
languagetext
#foreach ($tag in $doc.inlineTags)
$tag.kind
$tag.text
#end
  • Print a raw comment (plain text without a document parser or HTML renderer):
Code Block
languagetext
$doc.rawComment
  • Print all block tags:
Code Block
languagetext
#foreach ($tag in $doc.tags)
$tag.kind : $tag.text
#end
  • Print all param tags:
Code Block
languagetext
#foreach ($tag in $doc.getTags("param"))
$tag.name - $tag.comment
#end
  • Print all throws tags:
Code Block
languagetext
#foreach ($tag in $doc.getTags("throws"))
$tag.name - $tag.comment
#end
  • Print all see tags:
Code Block
languagetext
#foreach ($tag in $doc.getTags("see"))
$tag.label - $tag.reference
#end


Reference Documents