Open-Source tool in Java to parse source code to automatically draw UML class Diagram using PlantUML
The display options are used to filter objects which will appear in the result PlantUML file. It is different from exclude and include options which filter parsed files.
Right now, three display options are supported : by type, by package name, by name.
Here is the current list of all supported display options (others may be added in future versions) :
Considering this simple Java file :
package output; import output.test.Enum1; import output.test.Class2; import output.test.Class3; import output.test.Interface1; import output.test.Interface3; import static output.test.Class4.MAX_LENGTH; @Deprecated public class Class1 extends Class3 < String > implements Interface1 { public static native void register_Natives(); @Override public int count() { return 0; } }
Considering that all objects are known, here is the list of all dependencies of this class :
Now, let's play with different options to see the result :
The default option -dt abstract_classes,annotations,classes,enums,extensions,implementations,imports,interfaces,native_methods,static_imports will display all objects and all relations, in our case this will generate :
@startuml annotation java.lang.Deprecated annotation java.lang.Override class javax.native.NativeCall << (N,#ffff00) >> class output.Class1 class output.test.Class2 class output.test.Class3 class output.test.Class4 enum output.test.Enum1 interface output.test.Interface3 interface output.test.Interface1 output.Class1 ..> java.lang.Deprecated output.Class1 ..> java.lang.Override output.Class1 ..> javax.native.NativeCall output.Class1 ..> output.test.Class2 output.Class1 --|> output.test.Class3 output.Class1 ..> output.test.Class4 output.Class1 ..> output.test.Enum1 output.Class1 ..> output.test.Interface3 output.Class1 --|> output.test.Interface1 @enduml
The option -dt interfaces,implementations,extensions,imports,static_imports will display all interfaces with relations to interfaces, in our case this will only generate :
@startuml interface output.test.Interface1 interface output.test.Interface3 @enduml
The option -dt classes,interfaces,implementations,extensions,imports,static_imports will display all classes and interfaces with relations to classes and interfaces, in our case this will only generate :
@startuml class output.Class1 class output.test.Class2 class output.test.Class3 class output.test.Class4 interface output.test.Interface1 interface output.test.Interface3 output.Class1 ..> output.test.Class2 output.Class1 ..> output.test.Class4 output.Class1 ..> output.test.Interface3 output.Class1 --|> output.test.Interface1 @enduml
The option -dt native_methods will display the native object if one of the parsed object uses it, in our case this will only generate :
@startuml class javax.native.NativeCall << (N,#ffff00) >> @enduml
The option -dt native_methods,classes will display all classes, the native object if one of the parsed object uses it and all relations between classes and the native object, in our case this will only generate :
@startuml class javax.native.NativeCall << (N,#ffff00) >> class output.Class1 class output.test.Class2 class output.test.Class3 class output.test.Class4 output.Class1 ..> javax.native.NativeCall @enduml
These options allow to filter output object by their package name, for instance :
The option -dp ^java.* will display all objects which belong to a package starting with java :
@startuml annotation java.lang.Deprecated annotation java.lang.Override class javax.native.NativeCall << (N,#ffff00) >> @enduml
These options allow to filter output object by their name, for instance :
The option -dn Class. will display all objects which have a name starting with Class, followed by only one character :
@startuml class output.Class1 class output.test.Class2 class output.test.Class3 class output.test.Class4 output.Class1 ..> output.test.Class2 output.Class1 --|> output.test.Class3 output.Class1 ..> output.test.Class4 @enduml