To run in Eclipse:
- Create a new run configuration (
Run -> Run Configurations...
). SelectUML-Generator
as the project andUMLGeneratorApp
as the main class. - In the Arguments tab, provide (fully qualified) Java class names as the program arguments.
- E.g., to generate UML for Java's
List
andArrayList
classes, enterjava.util.List java.util.ArrayList
- Note class names are delimited by spaces (no commas)
- E.g., to generate UML for Java's
- There are several flags to modify behavior:
-r
or--recursive
to recursively parse and display classes discovered while parsing the provided classes--public
to render only Public classes, fields, and methods;--protected
to render only Public and Protected classes fields, and methods;--private
to render all classes, fields, and methods (default:private
)- So to recursively display the public API of
ArrayList
and all of its ancestors,-r --public java.util.ArrayList
- Flags can be in any order and any position. Providing more than one access level flag (
--public
,--protected
,--private
) yields undefined behavior.
- Run the newly created configuration. The generated UML will be in the
./output/out.dot
file.
This project features a robust framework for customizing the setup and
operations in the config file. This is, by default, located in the
config/settings.txt file. To change this, pass the command
--settings=<filepath>
where <filepath>
is the path to the file you
want parsed as the config file.
The format for the file is very simple, specifically in the form var = value
. The list of legal variables is as follows:
recursive
: boolean value that determines whether or not the UML will be generated recursively- Default: false
- Example:
recursive = true
synthetic
: boolean value that determines whether or not the UML should display synthetic methods (like lamda's)- Default: false
- Example:
synthetic = true
include
: list of fully qualified class names separated by spaces to include in the rendering- Default:
- Example:
include = java.util.String java.util.ArrayList
exclude
: list of package prefixes (such asjava/lang/
) to exclude from the rendering; this has lower priority than theinclude
keyword, and is therefore only really useful in combination with therecursive
variable- Default:
- Example:
exclude = java/lang/ java/util/
patterns
: list of fully qualified patterns and pattern decorators separated by spaces then semicolon; the format should be < + ;>*; these will be drawn in the order they're written, so the earliest one can be overwritten by later ones; patterns can take an arbitrary number of String parameters (which they may or may not use, see specific implementations) which are passed inside of parentheses separated by a comma and NO SPACE- Default:
patterns.IdentityPattern
- Example:
patterns = patterns.IdentityPattern; patterns.MalformedDecoratorPattern patterns.ColorDecorator(orange,red);
- Default:
access
: one ofpublic
,private
, orprotected
to determine what visibility to render; this is the same as the--public
,--private
, and--protected
command line arguments and will be overridden by them- Default:
private
- Example:
access = protected
- Default:
generate
: list of fully qualified graph generator class names separated by spaces to use to generate the graph from the class files- Default:
graph.SuperGraphGen graph.ImplementsGraphGen graph.AssociationGraphGen graph.DependencyGraphGen
- Example:
generate = graph.SuperGraphGen myGraphGen
- Default:
exporter
: single fully qualified exporter class name to be used to export the final generated graph; this also supports the same arbitrary string arguments aspatterns
- Default:
exporters.FileExporter
- Example:
exporter = exporters.FileExporter(./output/newOut.dot)
- Default: