Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create multiple levels of indentation in Javadoc?

Suppose, that as part of documenting your code (Javadoc) you want to indicate that the relationships between elements using deep indentation.

How can I create a nested list as:

  • some element
    • some other element
      • yet some other element
like image 683
James Raitsev Avatar asked Jun 25 '11 15:06

James Raitsev


People also ask

What does @SEE do in Javadoc?

We can use the @see and @link tag multiple times in a class, package, or method. The @see tag declares references that point to an external link, class, or method. The @link tag can also be used multiple times for declaring inline links or in contrast with other block tags.

How do I format a Javadoc?

Use the standard style for the Javadoc commentJavadoc only requires a '/**' at the start and a '*/' at the end. In addition to this, use a single star on each additional line: /** * Standard comment. */ public ... /** Compressed comment.

How do you reference another method in Javadoc?

Javadoc provides the @link inline tag for referencing the members in the Java classes. We can think of the @link tag as similar to the anchor tag in HTML, which is used to link one page to another via hyperlinks. Similar to the anchor tag, the path_to_member is the destination, and the label is the display text.


2 Answers

<ul>   <li>Element</li>   <ul>      <li>Subelement...</li> 

You can pretty freely use HTML inside javadoc comments.

Update: Because it came up, I tried

<ul>     <li>one</li>     <ul>         <li>one point one</li>     </ul>    </ul> 

and get

  • one
    • one point one

I agree proper nesting is better.

like image 125
Charlie Martin Avatar answered Sep 24 '22 18:09

Charlie Martin


The correct way is as follows:

/**  * <ul>  *   <li>some element  *   <li><ul>  *     <li>some other element  *     <li><ul>  *       <li>yet some other element  *     </ul>  *   </ul>  * </ul>  */ 

Although JavaDoc borrows from HTML, it isn't HTML, and you should omit the </li> tags, just as you should omit </p> tags.

like image 24
SeverityOne Avatar answered Sep 23 '22 18:09

SeverityOne