Class Diagram Options
A number of command-line options contol the operation of UMLGraph
class diagram generator:
- -output
- Specify the output file (default
graph.dot
).
If the output directory is provided, -output can only specify a file name,
otherwise a full path is accepted as well.
If the filename specified is a dash, then the results are printed on the
standard output, and can be directly piped into dot.
Note that, in order to avoid javadoc messages to contaminate
UMLGraph's output, you must execute UMLGraph directly as a jar,
not through javadoc.
- -d
- Specify the output directory (defaults to the current directory).
- -outputencoding
- Specify the output encoding character set (default
ISO-8859-1
).
When using dot to generate SVG diagrams you should specify
UTF-8
as the output encoding, to have guillemots correctly
appearing in the resulting SVG.
- -qualify
- Produce fully-qualified class names.
- -horizontal
- Layout the graph in the horizontal direction.
- -attributes
- Show class attributes (Java fields)
- -operations
- Show class operations (Java methods)
- -constructors
- Show a class's constructors
- -visibility
- Adorn class elements according to their
visibility (private, public, protected, package)
- -types
- Add type information to attributes and operations
- -enumerations
- Show enumarations as separate stereotyped primitive
types.
- -enumconstants
- When showing enumerations, also show the values they can take.
- -all
- Same as
-attributes
-operations
-visibility
-types
-enumerations
-enumconstants
- -nodefillcolor
- Specify the color to use to fill the shapes.
- -nodefontname
- Specify the font name to use inside nodes.
- -nodefontabstractname
- Specify the font name to use
inside abstract class nodes.
- -nodefontsize
- Specify the font size to use inside nodes.
- -nodefontclassname
- Specify the font name to use for the class names.
- -nodefontclassabstractname
- Specify the font name use for the
class name of abstract classes.
- -nodefontclasssize
- Specify the font size to use for the class names.
- -nodefonttagname
- Specify the font name to use for the tag names.
- -nodefonttagsize
- Specify the font size to use for the tag names.
- -nodefontpackagename
- Specify the font name to use for the package
names (used only when the package name is postfixed, see -postfixpackage).
- -nodefontpackagesize
- Specify the font size to use for the package
names (used only when it package name is postfixed, see -postfixpackage).
- -nodefontcolor
- Specify the font color to use inside nodes.
- -edgefontname
- Specify the font name to use for edge labels.
- -edgefontsize
- Specify the font size to use for edge labels.
- -edgefontcolor
- Specify the font color to use for edge labels.
- -edgecolor
- Specify the color for drawing edges.
- -bgcolor
- Specify the graph's background color.
- -postfixpackage
- When using qualified class names, put the
package name in the line after the class name, in order to reduce the
width of class nodes.
- -hide
- Specify entities to hide from the graph.
Matching is done using a non-anchored regular match.
For instance, "
-hide (Big|\.)Widget
" would hide "com.foo.widgets.Widget
" and
"com.foo.widgets.BigWidget
". Can also be used without arguments,
in this case it will hide everything (useful in the context of views
to selectively unhide some portions of the graph, see the view chapter for
further details).
- -view
- Specify the fully qualified name of a class that contains
a view definition. Only the class diagram specified by this view will be generated.
See the views chapter for more details.
- -views
- Generate a class diagram for every view found in the source path.
- -inferrel
- Try to automatically infer relationships between classes by inspecting
field values. See the class diagram inference chapter for further details. Disabled by default.
- -inferreltype
- The type of relationship inferred when -inferrel is activated.
Defaults to "navassoc" (see the class modelling chapter for a list of relationship types).
- -inferdep
- Try to automatically infer dependencies between classes by inspecting
methods and fields. See the class diagram inference chapter for more details. Disabled by default.
- -inferdepinpackage
- Enable or disable dependency inference among classes in the
same package. This option is disabled by default, because classes in the same package are supposed
to be related anyway, and also because there's no working mechanism to actually detect all
of these dependencies since imports are not required to use classes in the same package.
- -inferdepvis
- Specifies the lowest visibility level of elements used to infer
dependencies among classes. Possible values are private, package, protected, public, in this
order. The default value is private. Use higher levels to limit the number of inferred dependencies.
- -useimports
- Will also use imports to infer dependencies.
Disabled by default, since it does not work properly if there are multiple
classes in the same source file (will add dependencies to every class in
the source file).
- -verbose2
- Will print on the standard output details regarding
the progress of graph generation.
(Note that -verbose is a javadoc option with a different meaning).
- -collpackages
- Specify the classes that will be treated as
containers for one to many relationships when inference is enabled.
Matching is done using a non-anchored regular match. Empty by default.
- -apidocroot
- Specify the URL that should be used as the "root" for local classes.
This URL will be used as a prefix, to which the page name for the local class or
package will be appended (following the JavaDoc convention).
For example, if the value
http://www.acme.org/apidocs
is
provided, the class org.acme.util.MyClass
will be mapped to the URL
http://www.acme.org/apidocs/org/acme/util/MyClass.html
.
This URL will then be added to .dot diagram and can be surfaced in the
final class diagram by setting the output to SVG, or by creating an HTML page
that associates the diagram static image (a .gif or .png) with a client-side
image map.
- -apidocmap
- Specify the file name of the URL mapping table.
The is a standard Java property file, where the property name is a regular
expression (as defined in the java.util.regex package) and the property value is
an URL "root" as described above.
This table is used to resolved external class names (class names that do not
belong to the current package being processed by UMLGraph). If no file is provided,
external classes will just be mapped to the on-line Java API documentation.
- -noguillemot
- Specify that guillemot characters should not
be used to denote special terms like "interface" and stereotype names.
This is used on some platforms to circumvent problems associated
with displaying non-ASCII characters.
- -compact
- Generate compact dot files, that is, print html labels
in a single line instead of "pretty printing" them. Useful if the dot file
has to be manipulated by an automated tool (e.g., the UMLGraph regression
test suite).
- -link
- A clone of the standard doclet
-link
option, allows UMLGraph to generate links from class symbols to their external javadoc
documentation (image maps are automatically generated in UMLGraphDoc, you'll have to generate them
manually with graphviz if using UMLGraph).
All colors can be either a symbolic name (e.g. blue),
a tripple specifying hue-saturation-brightness as values 0-1
(e.g. ".13 0.9 1"),
or a tripple specifying red-green-blue values as hexadecimal
digits prefixed by a # (e.g. "#ff8020").
The symbolic color names are derived from the X Windows System;
you can find a complete list in the
Graphviz documentation
Font names are passed directly to the dot graph generation back-end.
In general the Postcript standard names Times, Helvetica, Courier, and
Symbol are safe to use.
Since the options are really a part of the generated graph you
want in many cases to include them in the diagram specification.
You can do that by adding javadoc @opt
tags in front
of a class named UMLOptions
, as in the following example:
/**
* @opt horizontal
* @opt all
* @hidden
*/
class UMLOptions {}
You can also change the UMLGraph operation on a per-class basis by
using @opt
attributes on individual classes.
In this case the @opt
specification temporarily overrides
the particular global setting for the class being processed.
Finally, you can reset an option to its default value by prefixing it
with an exclamation mark. For example:
/**
* @opt !attributes
* @opt !nodefontsize
*/
class MyClass {}
will disable attribute listing for MyClass, and reset the node font size
to its default value (10).