如何从现有的Java代码生成UML图(特别是序列图)?
当前回答
使用IntelliJ IDEA。要生成类图,选择package并按Ctrl + Alt + U:
默认情况下,它只显示类名,而不显示所有依赖项。要更改它:右键单击->显示类别…和显示依赖项:
要生成依赖关系图(UML部署图),使用maven go View -> Tool Windows -> maven Projects,并按Ctrl + Alt + U:
结果:
此外,还可以生成更多其他图表。见文档。
其他回答
您可以使用Eclipse 3.5的EclipseUML的30天评估版本:http://www.uml2.org/eclipse-java-galileo-SR2-win32_eclipseUML2.2_package_may2010.zip 这不是最新的3.6版本,但是非常好,并且不需要您购买它来进行测试和逆向工程。
反向工程:http://www.forum-omondo.com/documentation_eclipseuml_2008/reverse/reverse/reverse_engineering_example.html
现场flash演示:http://www.ejb3.org/reverse.swf
EclipseUML Omondo是世界上最好的Java工具。在这个实时java同步市场上,似乎只有eUML可以与之竞争,但是eUML在代码中添加了模型标签,这真的非常非常糟糕,对我来说是一个绝对的失败。
到目前为止,我用过的最好的逆向工程工具和往返java -> UML是Borland's Together。它是基于Eclipse的(不仅仅是一个插件),而且工作得非常好。
你的代码库是什么?Java还是c++ ?
eUML2 for Java is a powerful UML modeler designed for Java developper in Eclipse. The free edition can be used for commercial use. It supports the following features: CVS and Team Support Designed for large project with multiple and customizable model views Helios Compliant Real-time code/model synchronization UML2.1 compliant and support of OMG XMI JDK 1.4 and 1.5 support The commercial edition provides: Advanced reversed engineering Powerful true dependency analyze tools UML Profile and MDD Database tools Customizable template support
我注意到Intellij的SequenceDiagram插件也是一个不错的选择。
ObjectAid UML Explorer
是我用的。它很容易从存储库安装:
Name: ObjectAid UML Explorer
Location: http://www.objectaid.com/update/current
并生成相当不错的UML图:
网站描述:
The ObjectAid UML Explorer is different from other UML tools. It uses the UML notation to show a graphical representation of existing code that is as accurate and up-to-date as your text editor, while being very easy to use. Several unique features make this possible: Your source code and libraries are the model that is displayed, they are not reverse engineered into a different format. If you update your code in Eclipse, your diagram is updated as well; there is no need to reverse engineer source code. Refactoring updates your diagram as well as your source code. When you rename a field or move a class, your diagram simply reflects the changes without going out of sync. All diagrams in your Eclipse workspace are updated with refactoring changes as appropriate. If necessary, they are checked out of your version control system. Diagrams are fully integrated into the Eclipse IDE. You can drag Java classes from any other view onto the diagram, and diagram-related information is shown in other views wherever applicable.
推荐文章
- 到底是什么导致了堆栈溢出错误?
- 为什么Android工作室说“等待调试器”如果我不调试?
- Java:路径vs文件
- ExecutorService,如何等待所有任务完成
- Maven依赖Servlet 3.0 API?
- 如何在IntelliJ IDEA中添加目录到应用程序运行概要文件中的类路径?
- getter和setter是糟糕的设计吗?相互矛盾的建议
- Android room persistent: AppDatabase_Impl不存在
- Java的String[]在Kotlin中等价于什么?
- Intellij IDEA上的System.out.println()快捷方式
- 使用Spring RestTemplate获取JSON对象列表
- Spring JPA选择特定的列
- URLEncoder不能翻译空格字符
- Java中的super()
- 如何转换JSON字符串映射<字符串,字符串>与杰克逊JSON