Reading JavaDoc from Code
If I have a folder structure with .java files in it, and I want to point JavaDoc at it and have it tell me JavaDoc info, how do I do that? One way is to extend Doclet, but then I can only call it from the command line with javadoc -doclet ... However, what if I just want to do it from ordinary code?
Thats cool thanks anyway.Maybe this will help, does anyone know how Eclipse or Netbeans reads and displays the Javadoc info when you import a library? Do you think they just have their own parsers, or do they do it through the javadoc api?
What I ended up doing was this. Using the execute() method you mentioned I run a custom Doclet on my files, and the Doclet connects back to the program using Sockets and gives back the information I needed. This would have been extremely easy if the DocImpl classes were Serializable, but unfortunately (like any other useful Java class Ive ever tried to serialize), they're not. I eneded up just passing a Map of method names and descriptions, which basically worked all right. Hope this helps someone!
Looks like you found a solution. Here are a couple of belated answers, passed along from an engineer...
> Do you know how my Doclet class could communicate with the rest of the program?
The easiest (not really clean) might be to just create a singleton for
communication, which is shared by all instances of the doclet, and
whatever other point in the program care about it.
> Does anyone know how Eclipse or Netbeans reads and displays the Javadoc info when you
> import a library? Do you think they just have their own parsers, or do they do it through
> the javadoc api?
Eclipse has its own parsers. Netbeans uses javac. - Hey, Netbeans
comes from Sun, you'd expect that.