Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's three possible ideas, none of which I really like:</p> <ol> <li><p>Instead of defining your own <code>Taglet</code>, use the <code>-tag</code> option to the <code>javadoc</code> command to support <code>@note</code>. Of course, this won't let you define your own custom formatting.</p></li> <li><p>You could use <code>tag.holder().setRawCommentText(String)</code>. My experience playing with this is that this lets you add tags, but doesn't let you rewrite a tag. So you can't do a string replacement on <code>tag.holder().getRawCommentText()</code> and then have the standard doclet render the inline tags properly, but you could probably have your <code>Taglet.toString(Tag[])</code> method generate the html, including the raw form of the inline tags, and then append to the raw comment text "<code>@renderedNote</code> <em>markedUp Tag.text()</em>" where <code>@renderedNote</code> is another tag, defined using <code>-tag</code>. Your <code>Taglet.toString(Tag[])</code> should then return an empty string. However, not only is this ugly, I don't know if this relies on undocumented behavior and so I don't know how robust or future proof this idea is.</p></li> <li><p>You could have your <code>Taglet</code> also implement <code>com.sun.tools.doclets.internal.toolkit.taglets.Taglet</code>. This seems to be how the standard taglets are defined. The two methods you then have to implement are <code>TagletOutput getTagletOutput(Tag tag, TagletWriter writer)</code> and <code>TagletOutput getTagletOutput(Doc doc, TagletWriter writer)</code>. I think the latter can just <code>throw IllegalArgumentException()</code>. If you also keep the <code>Map</code> provided when your <code>Taglet</code> was registered, then you may be able to render several of the inline tags that you encounter by looking up the tag name in that <code>Map</code> to get its implementing <code>com.sun.tools.doclets.internal.toolkit.taglets.Taglet</code> and delegating to its <code>getTagletOutput</code> method. However, it looks like, for example, <code>@link</code> tags are not registered in that map; for those, it's possible (but I haven't checked) that because <code>@link</code> tags are supposedly provided as <code>SeeTag</code> you may be able to use the map from <code>@see</code> instead, or you could cast the <code>TagletWriter</code> to <code>TagletWriterImpl</code> and then use <code>TagletWriterImpl.seeTagOutput(Doc, SeeTag[])</code>. For <code>Text</code> tags, you can generate <code>TagletOutput</code> instances via <code>new TagletOutputImpl(String)</code>. Finally all the <code>TagletOutput</code> instances that you get this way can be combined into a single <code>TagletOutput</code> to be returned using <code>TagletOutput.append(TagletOutput)</code>.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload