博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to generate UML Diagrams from Java code in Eclipse
阅读量:7085 次
发布时间:2019-06-28

本文共 2030 字,大约阅读时间需要 6 分钟。

UML diagrams compliment inline documentation ( javadoc ) and allow to better explore / understand a design. Moreover, you can print and bring them to table to discuss a design.

In this post, we will install and use the ObjectAid plugin for Eclipse to produce jUnit lib class diagrams. Then, we will be able to generate UML diagrams by simply dragging and dropping classes into the editor. We can further manipulate the diagram by selecting which references, operations or attributes to display.  

  • Open Eclipse and go to Help > Install New Software
  • Click on add to add a new repository
  • Enter name ObjectAid UML Explorer
  • Enter Location http://www.objectaid.net/update

Next, select the ObjectAid Class Diagram plugin - it is free - and click Next. The Sequence Diagram one requires a paid license.

Click Finish to confirm your choices and start the instalation process.

  • Click Ok on the security warning
  • Select Restart Now after the installation completes to restart Eclipse.

To create a new UML diagram we start the ObjectAid wizard with File > New > Other... and start typing in the textbox Class Diagram to filter the desired wizard. Click Next, and enter a directory and name for the diagram.

Drop java source or compiled class files into the visual UML editor to start populating the diagram. Right click on a generated class to bring up a context menu and adjust visibility, operations attributes, etc as you like.
Below, we see the Assert class from the jUnit library with all operations and fileds hidden.

 

From the context menu, we can add implementations and associations for a selected class. In the following screen, we add the interface Test implemented by the TestCase class.

This is how part of the jUnit UML class diagram look after adding some more classes.

To auto layout the diagram right click anywhere within the editor and select Layout Diagram. From the same menu, you can export the diagram to an image ( gif png jpeg ) by clicking the Save As Image... menu item

转载于:https://www.cnblogs.com/bruceyo/p/3695801.html

你可能感兴趣的文章
云计算意义众多 博主总结七大特点
查看>>
iOS中 常用的mac终端指令汇总 技术分享
查看>>
VC++ .NET 2003 –安装和使用Boost 1.30和Blitz++0.6
查看>>
红海已现 透视2014国内公有云市场
查看>>
保持高增速 阿里云连续7个季度规模翻番
查看>>
苹果紧急发布新系统iOS 11.0.1 修复多种BUG
查看>>
输得太不光彩!Uber司机把算法当游戏
查看>>
亚信安全成为 “上海网络与信息安全监测预警平台” 首批发起单位
查看>>
浪潮HF系列固态存储的独门绝活儿
查看>>
“雪花”项目:Microsoft探索在.NET中实现手工内存管理
查看>>
构建基于容器的本机监控系统 应该注意什么?
查看>>
从CSE Asia 2016亚洲消费电子展看智能设备安全
查看>>
未来五年存储发展趋势猜想
查看>>
浪潮IPF2016宣布一系列举措背后的思考是什么?
查看>>
每一个程序员要遵守的一些优秀编程风格
查看>>
大数据化雨落地 BDA万唤始出来
查看>>
三头狗又来了 Windows再现毁灭级漏洞
查看>>
企业安全需警惕:流行APP均遭恶意软件克隆
查看>>
IDG评2008十大IT新闻 蓝光标准胜出入围
查看>>
阿里CEO张勇:网络安全需要全生态协作
查看>>