Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is nesting of javadoc tag {@Code{@link}} allowed?

Tags:

javadoc

I am trying to place a link inside a code tag in the javadoc. Below is my attempt.

/**
* This method builds XML.
* <pre>
* {@code
* <Person {@link #companyId}='1234'/>
* }
* </pre>
**/

But in the generated Javadoc, the link is absent. The string {@link #companyId}='1234' is coming as it is.

  • Is nesting of javadoc tags allowed?
  • Is there a way to add links in code?
like image 886
auhuman Avatar asked Nov 21 '11 06:11

auhuman


1 Answers

It depends on the tag. The {@code ...} tag interprets its content as-is, i.e. avoids any interpretation of the content as either Javadoc or HTML. It is similar for the contents of the {@link ... } tag.

Here is a workaround:

/**
 * This method builds XML.
 * <pre>
 * {@code <Person }{@link #companyId}{@code ='1234'/>}
 * </pre>
 **/
like image 143
Paŭlo Ebermann Avatar answered Oct 02 '22 12:10

Paŭlo Ebermann