Create a Class diagram

Go to [Diagram] – [Class Diagram] to create a Class diagram.
Create Class Diagram menu

section divider

Auto-create Class diagrams

You can automatically create Class diagrams of a package.

  1. If you have source code, import first to Astah.
    How to import Java source code
    Use Plug-ins to import source code (C++, C#, and Java)
  2. Right-click on a package in a tree view and select [Auto Create Class Diagram]
    Automatically Create Class Diagram
  3. Now you have three options.
    Three options on how you want to auto-create Class diagram

1. Simple

This creates a class diagram without Attributes and Operations inside the classes.
Auto Create Class Diagram in simple version

2. Detailed

This creates a class diagram with Attributes and Operations inside the classes.
Auto Create Class Diagram in detailed version

3. Unpack Subpackages

This creates a class diagram with the whole models including models inside the sub-packages if the package you select has sub-packages.
Auto-create with models inside sub-packages

section divider

Class

Creating a Class

You can find out 5 ways to create a Class in the Diagram Editor page.
UML Class


Template Class

You can create a Template Class by adding Template Parameters to a class. There are two ways to do so.
Template-class

  1. Select [Add Template Parameter] from Class’s Pop-up menu
    Adding a template class

  2. Define details at the bottom-left pane under [Template Class].
    Template-class-property
section divider

Attributes

You can create Attributes by clicking the orange diamond that appears when you have a mouse over a Class.
Attribute-diamond

Also, you can create another attribute by hitting the [Enter] key while an attribute is selected.
Creating Attributes

Attribute Visibilities

There are several ways to show/hide attributes.
In order to change the visibility of attributes on a currently-opened diagram, open the [Initial Visibility] tab from the left-bottom pane in Astah and check the options you want in a diagram and click the [Apply to existing elements] button.
Initial Visibility in Class Diagram

section divider

Operations

You can create Attributes by clicking a green bar that appears when you have a mouse over a Class.
Green bar to add operations

Also, you can create another attribute by hitting [Enter] key while an attribute is selected.
Methods to Class

Moving Attributes/Operations

You can move around attributes/operations by dragging them to another class or within a class.
Moving attributes

section divider

Anonymous Bound Class

You can create an anonymous bound class by deleting the name of Bound Class.
Anonymous Bound Class

Anonymous Bound Classes can be specified to the following:

  • Attribute Type
  • Operation Return Value
  • Operation Parameter Type
  • The target of Association End A and Association End B
  • Base Class of Instance Specification in Class
  • Base Class of Object Node in Activity Diagram
  • Base Class of Lifeline in Sequence Diagram and Communication Diagram

Example of creating a Bound Class

  1. Create a abound class.
  2. Create a new class and add an attribute whose type is bound class to it.
    Bound Class

  3. When you add the class, you will be asked if you’d like to create a new class. Click [Yes].
    Box to ask a new class

  4. Click [Show Hidden Relationship] from its pop-up menu.
    Show hidden menu

  5. Then you will get the relationship of the anonymous bound class.
    Anonymous Bound Class


Nest a Class

You can have a class nested to a package by dragging it into a Package.
Nested Class

section divider

Association

You can create associations by choosing an association type from a small icon list that appears when you hover a mouse over a class, then directly click on the target class.
Create Association
Please refer to “Drawing Lines” for more information.

Put Association name back

As your diagram gets complex, association names could be left out and end up being far away from the association line.
In that case, you can bring the association name back to the center of the association line.
Right-click on an association line and click [Init Label Position].
Bring association name back