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

How to generate UML Diagrams from Java code in Eclipse的更多相关文章

  1. UML Diagrams Using Graphviz Dot

    Introduction Background This article is about using the dot tool from the Graphviz package to automa ...

  2. Java语言编码规范(Java Code Conventions)

    Java语言编码规范(Java Code Conventions) 名称 Java语言编码规范(Java Code Conventions) 译者 晨光(Morning) 简介 本文档讲述了Java语 ...

  3. java code to byte code--partone--reference

    Understanding how Java code is compiled into byte code and executed on a Java Virtual Machine (JVM) ...

  4. [转]Java Code Examples for android.util.JsonReader

    [转]Java Code Examples for android.util.JsonReader The following are top voted examples for showing h ...

  5. SQL to Java code for Elasticsearch

    Elasticsearch虽然定位为Search Engine,但是因其可以持久化数据,很多时候,我们把Elasticsearch当成Database用,但是Elasticsearch不支持SQL,就 ...

  6. JUnit单元测试教程(翻译自Java Code Geeks)

    JUnit单元测试教程--终极指南 JUnit单元测试教程终极指南 说明 单元测试简介 1 什么是单元测试 2 测试覆盖 3 Java中的单元测试 JUnit简介 1 使用Eclipse实现简单JUn ...

  7. Java Code Style

    近期困惑于团队成员代码风格迥异,代码质量不可控,作为一名老司机,忧患于后期服务的可维护性,多次一对一的代码Review,耗时耗力不说,效果也不明显.痛定思痛,多次反思之后得出结论:无规矩不成方圆,可靠 ...

  8. 玩转Eclipse — 自动代码生成的Java Code Template

    文章转载地址:点击打开链接 当代码写到一定程度之后,就会发现很多代码都被重复地敲了N多遍,甚至毫不夸张地说:闭着眼睛都能敲出来.大量地敲这些重复地代码,除了锻炼敲键盘的速度,基本上没有其他益处,但是长 ...

  9. Use formatter to format your JAVA code

    In order to make the codes looks unified and make it easy to understand, it's better to use the same ...

随机推荐

  1. 帆软报表FineReport2016年1月份产品更新一览

    .条件属性可使用页码参数插件 由于报表计算逻辑关系,条件属性中取不到页码公式.但是有些场景下又是需要在条件属性中取到页码的,比如标题只要偶数页显示,比如奇数页标题标红等等. 插件安装完成后,条件属性里 ...

  2. 遍历List集合,删除符合条件的元素

    List集合的遍历有三种方式:增强for循环,普通for循环,Iterator迭代器遍历 如果只是对集合进行遍历,以上三种循环都可正常遍历: (1)增强For循环遍历List集合 List<St ...

  3. python-网络编程-socket编程

    一.TCP\IP(网络通信协议)简介       TCP:(Transmission Control Protocol)传输控制协议,面向有连接的通信协议  UDP:数据报文协议,面向无连接的通信协议 ...

  4. alexkn android第一行代码-7.广播

    0.Android 中的广播主要可以分为两种类型,标准广播和有序广播.标准广播(Normal broadcasts)是一种完全异步执行的广播,在广播发出之后,所有的 广播接收器几乎都会在同一时刻接收到 ...

  5. cf Round 607

    A.Chain Reaction(DP+二分) 题意:一排有n个灯塔,每个灯塔给出坐标xi和力量yi,每次从最右边依次点亮灯塔,每点亮一个灯塔,它左边的距离它yi范围内的灯塔将受到损坏.现在允许在最右 ...

  6. .net线程池

    线程池的作用线程池,顾名思义,线程对象池.Task和TPL都有用到线程池,所以了解线程池的内幕有助于你写出更好的程序.由于篇幅有限,在这里我只讲解以下核心概念: 线程池的大小 如何调用线程池添加任务 ...

  7. 一道有意思的笔试题引发的对于new操作符的思考

    楼主比较喜欢看一些很短但很有意思的题目,无意间又瞥到了一题,大家不妨可以一试.(原题链接猛戳这里) function Fn1() { this.name = 'peter'; return { nam ...

  8. Android开发的菜鸟小记

    1.主线程异常:添加网络连接: 2.权限异常: 3.空指针异常:NullException: 添加网络权限: DEBUG:Connected to the target VM, address: 'l ...

  9. Microsoft.AspNet.Identity 自定义使用现有的表—登录实现

    Microsoft.AspNet.Identity是微软新引入的一种membership框架,也是微软Owin标准的一个实现.Microsoft.AspNet.Identity.EntityFrame ...

  10. 关于GeoWebCache的部署说明

    最近因为工作需要学习了GeoWebCache,有了一些实战经验跟大家分享一下. 废话不多说,直接上问题! 1.切片的缓存问题 当地图服务(这里默认指WMS)的数据更新时,GeoWebCache的切片如 ...