Home

 

Generating Javadoc with diagrams from existing tags

RAD v7.5 enables you to embed a @viz.diagram tag into Javadoc on the class, interface, or package level. The @viz.diagram tag assumed that the diagram being referenced is placed in the same folder as the Java file containing the @viz.diagram tag, and the wizard then exports that diagram into a GIF, JPG, or BMP, and embed it into the generated Javadoc.

Example | -8 shows the use of the @viz.diagram tag in the BankClient class.

Example 8-8 BankClient class with a @viz.diagram tag

package itso.rad75.bank.client;
...
/**
 * @viz.diagram ITSOBank-ClassDiagram.dnx
 */
public class BankClient {
	public static void main(String[] args) {
		try {
...

To generate Javadoc with diagrams from existing tags, do these steps:

Add the @viz.diagram tag to the source code, as shown in Example | -8, and copy the ITSOBank-Diagram.dnx file from the diagram folder to the itso.rad75.bank.client package.

Restriction: For Web applications, this has the side effect of the class diagrams being packaged into the WAR file with the compiled Java code. We found two possible work-arounds:

Manually remove these diagrams from the WAR file after exporting.

Configure an exclusion filter for the EAR export feature. Refer to Filtering the content of an EAR for information about techniques for filtering files (include and exclude) when exporting the EAR.

Select the project in the Package Explorer and select Project Æ Generate Javadoc with Diagrams Æ From Existing tags.

Note: The Java Modeling capability must be enabled (select Window Æ Preferences Æ Advanced Æ Java Æ Java Modeling) to see this action.

In the Javadoc Generation dialog, use the same options as in Figure | -38.

Click Next in the next dialog panel.

In the Configure Javadoc arguments dialog, select 1.6 for JRE source compatibility.

In the Choose diagram image generation options dialog, accept the default settings and click Finish.

When prompted to update the Javadoc location, click Yes to all.

Open the Javadoc (RAD75JavaImport/doc/index.html) in a browser. Verify that a diagram has been added to the generated Javadoc for the BankClient class by selecting the BankClient class in the All Classes pane.
ibm.com/redbooks