Astah supports modeling in Java, C++, and C#. If you are modeling in Java, set so in Astah first.
Select a root package on a tree and check [Java] in the bottom pane.
Then Java options in [Language] tab become available for Classes, Attributes, and Operations.
TIPS – Set Java to a project by default
You can set Java as your default programming language to Astah from [Tools] – [System Properties ] – [Project].
Import Java Source Code
You can import Java source code files and generate Class diagrams with the reversed models.
Go to [Tools] – [Java] – [Import Java].
Choose .java files you want to import and click [OK]. Make sure you select the right encoding.
Choose attributes that you want to import as associations.
Imported models are added to the tree.
Auto-generate Class Diagram
You can auto-create a Class diagram with the imported models.
Right-click on a package or class and choose [Auto Create Class Diagram]. Please refer to “Auto Create Class Diagrams” for more details and available options.
The generated diagram is opened in the Diagram Editor.
TIPS – Use Auto-layout
After generating a diagram, you can auto-layout the models vertically or horizontally from the [Alignment] – [Auto Layout] menu.
Use Reverse Plug-in
Astah’s Easy Code Reverse Plug-in is the easiest way to reverse source code from Github, Bitbucket, and Gooogle Project Hosting into a UML class diagram just by drag-and-dropping the URL a repository or the .java source code files directly on to Astah!
Directly drag the link of the .java file from online repository.
The imported model would appear on the diagram.
Generate Java source code
“Export Java” is used to generate Java Skeleton Code from selected Diagram Elements. The Definitions of Classes and Operations are exported as Documentation Comments.
Go to [Tools] – [Java] – [Export Java] from Main Menu.
Select the models you want to export to source code.
.java files would be generated. If the .java files with the same name already exist, the source code files would be completely replaced with what you last export. If you do not want the latest export to overwrite the whole source code and you want to keep any modifications you’ve made to the .java files, check [When overwriting, keep the information of existing code that is not in the model.] option.