Use MyEclipse to convert a java file into a UML class diagram, myeclipseuml
Use MyEclipse to convert a java file into a UML class diagram
Refer:
Use MyEclipse to convert java files into UML class diagrams-the world of the King's blog-CSDN blog http://blog.csdn.net/dan15188387481/article/details/50053807
MyEclipse draw UML use case diagram and generate JAVA code (Graphic detailed steps)-mushroom hunter column-CSDN blog http://blog.csdn.net/donggege214/article/details/48791413
When learning design patterns or interacting with others, creating UML diagrams is essential. Generally, we will draw a UML class diagram directly. for students, the common tool is Microsoft's Visio. This tool must be often used to draw various diagrams, flowcharts, network diagrams, and data flow diagrams, of course, you can draw a UML class diagram, which is very convenient to use. However, the weakness of Visio is that it does not support java uml class diagrams. It is estimated that it was developed by Microsoft, support C and C ++ in. For the moment, how can JAVA programmers draw UML class diagrams? You can directly create a UML project under eclipse, and then draw it according to the UML class diagram drawing method, but this is not the focus of this article. Many beginners or those who didn't draw a UML class diagram at first, after writing a project, they want to give an overview of what the UML class diagram of their own JAVA program is like, at this time, it is too troublesome to draw a UML class diagram step by step. It is estimated that everyone is unwilling to do this, is there a way to directly convert the design into a UML class diagram for browsing? The answer is yes, of course. There are many methods. This article only describes one of the methods I often use. Preparation tools: MyEclipse, Eclipse, and UML plug-ins (Green). The plug-in link is: Click to open the link. This article uses MyEclipse2015, which has a cracked version and is quite useful. Many plug-ins are available, I have been using this because it was downloaded on campus, so there is no link, you can find it on your own online. The first step is to prepare a project that has been designed. There must be at least two or three classes and some interfaces, as well as their direct inheritance and implementation relationships. This will make sense after conversion. See figure 1. Figure 1 step 1 Step 2: click New -- Other to create a UML Model Based on the options in Figure 2. Here there are two options available, both available and I prefer to use 2. Figure 2 Step 2 Step 3: Click Create UML2 Model. The following options are displayed, as shown in step 3. Select the UML folder. Figure 3 step 3 Step 4: Build the UML model as shown in Step 4. Then you can draw the UML class diagram directly in it, however, these steps are unnecessary for directly converting a JAVA file into a UML class diagram. Figure 4 step 4 Step 5 is actually the first step to directly generate a UML class diagram. Take this project as an example. Right-click the project package "headfirst. adapter. ducks ", then a series of options are displayed, and then click MyEclipse --- Generate UML2 Class digoal ..., the interface shown in Figure 5 is displayed. enter the name of the UML class diagram and click Finish. The generated UML class diagram 6 is shown. Figure 5 step 5 Figure 6 the generated UML class diagram in summary, the first four steps mainly refer to how to create a UML model and then use it to draw a picture, step 5 describes how to generate a UML class diagram directly using the JAVA file in the package of an project. This method is not limited. You are welcome to add it.
A brief look at the directory structure and UML use case diagram:
Directory structure preview:
Use Case chart preview:
Detailed steps (not much, a total of five steps ):
1. Create a JAVA Project
Open MyEclipse-> New-> Java Project-> enter the Project name (TV)-> Finish (-> if there is a pop-up window, select yes)
Ii. Create a UML use case diagram
Expand the project root directory first, right-click src-> New-> Other-> Find and expand MyEclipse in the list-> Find UML in the expanded items and expand-> UML1 Model-> Next-> Start name (TV) -> Finish-> yes (If yes, yes. If not)
3. Draw UML
Draw a UML case based on the preceding UML preview diagram (this step is not difficult. Just follow the steps below and double-click the class diagram or corresponding position in the interface diagram to enter the code in the diagram)
4. Generate JAVA classes through UML
On the menu bar, choose UML> Generate Java...> Select All> Finish> yes (if the use case diagram is not saved, the SAVE prompt is displayed. Select yes)
V. Complete supplements
Complete the code in each generated class, because the methods in the class are empty.
Complete other auxiliary classes and files