When creating a class diagram, sometimes we would draw it using the diagram toolbar and there are times we would reuse elements by drag & drop. However, when you start from scratch, sometimes it can be difficult to know which class goes with which because we may not necessarily know all relationships among them.
Luckily, there is a function called Form Diagram which automatically generates a class diagram from existing classes for you. You just need to specify one or more classes that you want to explore with.
This article will show you how.
Note: Visual Paradigm for UML (VP-UML) is used in the example below.
Before We Start
We have already reversed Java code for java.io & java.lang and you can see them in the Class Repository.
Steps To Take
Let’s say we want to take a closer look at the File class.
1. In the Class Repository, under base > java > io, right click on File.
2. While right clicking on File, select Form Diagram.
Under it there are 3 choices to select for your class diagram as follows:
– Customize… allows you to customize your own class diagram.
– Hierarchical diagram shows you the vertical structure of classes (e.g. a superclass over another).
– Navigation diagram shows you the horizontal structure of classes (e.g. which has associations with which).
3. Let’s say we’ve selected Customize…
In the Form Diagram dialog box, under the Form Diagram tab, the preview changes based on the current mouse location (e.g. Generalization, Association).
4. In the Form Diagram dialog box, under the Presentation Options tab, the preview changes on the current mouse position (e.g. Attribute Options).
Select the checkbox next to Show operation signatures. Click OK.
5. Click Yes to set the first view as the master view.
6. Your customized class diagram will then appear.
- Grouping Generalizations by Creating a Generalization Set
- Progressively Develop Conceptual, Logical and Physical ERDs
- When reversing Java code to sequence diagram, why can’t I select an operation?