• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Help using Doclet API to create Stubs

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello fellow Ranchers,

Need a way to create a source code stub (a new Java source file from a pre-existing Java source file) which includes JavaDoc (but does not contain any implementation specifics or private properties / private members). Read that the best way to go about doing this is by using the Doclet API located in the JVM's tools.jar archive.

Basically, need to write a Java program which does the following:

(1) Reads a top-level source directory (containing multiple source files) or a single Java source file.

(2) Parses a Java file and and then outputs a new Java file to a different directory.

(3) The newly created Java file, is the same as the first, but does not include implementation / details of the code, inside the methods. Also, it doesn't contain the private members and private fields from the original, but does contain public and protected properties and methods. It does need to include the JavaDoc comments from the original.

Here's an example:

e.g. Original .java source file:



The newly "stubbed" file still has the same name: Inventory.java (but is placed in a different directory):



Question(s):

(1) Is the Doclet API the best way to go about doing this?

(2) Are there any 3rd party tools that do this for a developer?

Happy coding to all,

Mike
[ July 18, 2008: Message edited by: Michael K. Wilson ]
 
Marshal
Posts: 80756
487
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hardly a beginner's question. Difficult to be sure where the best place to move it is, however.
reply
    Bookmark Topic Watch Topic
  • New Topic