@hidden
tag applied to classes, methods, and fields.
In theory you can also use UMLGraph to reverse engineer existing
Java code.
Note however that UMLGraph is not designed for this purpose;
the resulting graphs may be large and unwieldy.
UMLGraph is implemented as a javadoc doclet (a program satisfying the
doclet API that specifies the content and format of the output
generated by the javadoc tool).
Javadoc is part of the Sun JDK, so a typical JDK installation will also
include javadoc.
Before running javadoc you need to place the UmlGraph.jar
file in a location accessible by javadoc
(e.g. the Java class path or the current directory).
You then run javadoc with arguments -doclet UmlGraph
-docletpath /path/to/UmlGraph.jar
and append at the end the file(s) that contain your diagram
specification.
You can of course use any of the javadoc general options;
-private
is usually needed to avoid having to explicitly
specify public elements.
Specifying some packages before the list of source files will designate
those packages as local.
When you specify a package list,
the SVG output UmlGraph generates will contain
local hyperlinks for the local classes
and hyperlinks to the Sun Java API documentation for all other classes.
Example:
javadoc -docletpath UmlGraph.jar -doclet UmlGraph -private Simple.javajavadoc will create by default a file named
graph.dot
in the current directory; option to
this is a text file that can be processed by the Graphviz
dot program to layout and draw the graph.
A command line like the following will convert the graph.dot
file into Postscript:
dot -Tps -ograph.ps graph.dotRefer to the dot documentation for information on creating other file formats or adjusting the UMLGraph output. Note that when you use dot for generating SVG diagrams your should specify the
-outputencoding UML8
option to UMLGraph.
This option will correctly render the stereotype guillemot characters
in the dot output and the corresponding SVG file.
Contents | « Previous Next (Class Modelling) » |