O'Reilly logo

AspectJ Cookbook by Russ Miles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.6. Generating Javadoc Documentation

Problem

You want to generate javadoc format documentation for your AspectJ application.

Solution

Use the ajdoc tool from the command line or from within Eclipse.

Discussion

Java developers have used the javadoc tool for generating comprehensive documentation for their Java applications since Java 1.1. The javadoc tool was never designed to handle the new language constructs that AspectJ introduces and is not able to generate documentation for an AspectJ application. To meet this problem, the developers of AspectJ created ajdoc, a tool that extends javadoc so that it can correctly and usefully document the aspect-oriented structures in your application.

Providing your environment has been set up correctly, as shown in Recipe 2.1, the ajdoc tool can be accessed from the command line by typing the following command:

> ajdoc -sourcepath <The root location of you code> -d <The 
directory in which you want your documentation to be placed> <The 
file locations of each of the classes aspects and classes to include in 
the generated documentation>

The ajdoc tool provides the -argfile parameter so that you can provide an explicit AspectJ build configuration .lst file, as mentioned in Recipe 2.3. A .lst file contains the build configuration for a set of classes and aspects in your application for which documentation should be produced.

Using ajdoc means that you can now document your pointcuts, advice, and aspects as shown in Example 2-5.

Example 2-5. Applying javadoc ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required