Starting with the getPackageDoc
function from @ChadRetz's blog, I've created a utility class that contains a function that does what you wish: Given a com.sun.javadoc.Tag
, it returns the relative url from its enclosing file (the file containing that tag), to the JavaDoc root directory--this is the equivalent of {@docRoot}
.
The class is called ComSunJavaDocUtil
, and the function name is getRelativeUrlToDocRoot
.
An example taglet's toString()
function:
public String toString(Tag tag) {
return "Relative url to DOC ROOT for this tag's enclosing file is \"" +
ComSunJavaDocUtil.getRelativeUrlToDocRoot(tag) + "\"";
}
This utility class is part of Codelet. Installation instructions are here. If this utility class is all you're going to use, then the only jars you need on your classpath are codelet
and xbnjava
...and, of course, com.sun.javadoc
.