- Notifications
You must be signed in to change notification settings - Fork110
Automatically generate Graphviz diagram from your domain classes
License
NitorCreations/DomainReverseMapper
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Automatically generateGraphviz diagram from your domain classes.
Using reflection, Domain Reverse Mapper scans your packages that contain your domain entities. It then builds a graph of entity compositions and inheritances and creates a Graphviz .dot file from that.
The picture above is generated from a simple example domain with Domain Reverse Mapper. In the above picture
- black arrows describe composition (private field in one class refers to another domain class
- empty arrows show inheritance
- each package is grouped as a subgraph
- use code as forward thinking documentation to model your domain
- always have up-to-date diagram of your domain model
- use the diagram to help in discussions with your team and stakeholders
This tool can be either used manuallyfrom command line or as a maven plugin hooked to your build process.
Download the latest executable .jar fromReleases. Run this archive in classpath that also contains your domain model classes. So let's say your domain model is indomain.jar
, you can execute Domain Reverse Modeler with
java -cp domain.jar:drm-core-1.3.jar com.nitorcreations.DomainMapperCli -p com.mycompany.domain
This will scan all classes under the packagecom.mycompany.domain
and output the .dot file to your console output. If you want to write it to file use switch-f filename.dot
. If you need to scan multiple packages use format-p "com.package1, com.package2"
.
Use the generated .dot file with your local Graphviz or any of the online Graphviz tools to show your domain diagram.
NOTE! Do not usejava -jar
as this will override the classpath provided by-cp
switch so your domain classes won't get included and the produced graph will be empty.
Add to your pom.xml the following:
<build><plugins><plugin><groupId>com.nitorcreations</groupId><artifactId>drm-maven-plugin</artifactId><version>1.3</version><configuration><packages><param>com.mycompany.domain</param><param>com.mycompany.other_domain</param></packages></configuration><executions><execution><phase>process-classes</phase><goals><goal>map</goal></goals></execution></executions></plugin></plugins></build>
where thepackages
configuration parameter contains a list of packages that should be scanned for domain graph.
Whenprocess-classes
life-cycle phase gets executed, your domain model graph will be saved to/target/domainmodel.dot
. Use this file with your local Graphviz or any of the online Graphviz tools to show your domain diagram.
About
Automatically generate Graphviz diagram from your domain classes
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.