Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javadoc Inserting UML Diagrams

Is there a way to embed images into my JavaDoc? Basically i want to include some UML diagrams explaining the hierarchy of my classes in some of the documentation.

Thanks!

like image 255
Mo . Avatar asked Sep 11 '09 14:09

Mo .


5 Answers

Check out this section of the Javadoc documentation, which explains how to embed images in your Javadoc.

Also, here is an article describing how to reverse engineer UML diagrams and embed them in your Javadoc using UMLGraph.

like image 167
Adamski Avatar answered Nov 12 '22 17:11

Adamski


Yes.

The documentation explains how to embed arbitrary images to javadoc documentation.

If you want to generate UML class diagrams from your Java source, have a look at the UMLGraph doclet.

like image 21
laalto Avatar answered Nov 12 '22 15:11

laalto


This article shows how to use UMLGraph with Maven Javadoc plugin.

In short:

  1. Install GraphViz.

    Ubuntu: apt-get install graphviz4.
    Windows: download.

  2. Update pom.xml.

        <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.7</version>
            <configuration>
                <aggregate>true</aggregate>
                <show>private</show>
                <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                <docletArtifact>
                    <groupId>org.umlgraph</groupId>
                    <artifactId>doclet</artifactId>
                    <version>5.1</version>
                </docletArtifact>
                <additionalparam>
                    -inferrel -attributes -types -visibility -inferdep -quiet -hide java.* -collpackages java.util.* -qualify -postfixpackage
                    -nodefontsize 9
                    -nodefontpackagesize 7
                </additionalparam>
            </configuration>
        </plugin>
    
  3. Run mvn javadoc:javadoc.

like image 22
Ondra Žižka Avatar answered Nov 12 '22 16:11

Ondra Žižka


ApiViz is a nice doclet too.

like image 21
elhoim Avatar answered Nov 12 '22 16:11

elhoim


Simple Answer:

/**
 * This class does some stuff (see diagram).
 * <img src="relative/path/to/image.png" />
 * 
 */
 public class SomeClass{
 }
like image 43
Sileria Avatar answered Nov 12 '22 15:11

Sileria