Create a Class diagram

To create a Class diagram, go to [Diagram] – [Class Diagram].
A menu to create UML Class Diagram

section divider

Auto-create Class Diagrams

You can automatically generate Class diagrams from a package.

  1. If you have source code, import it into Astah first.
    How to import Java source code
    Use Plug-ins to import source code (C++, C#, and Java)
  2. Right-click on a package in the tree view and select [Auto Create Class Diagram].
    Auto Create Class Diagram Menu
  3. Now you have three presentation options.
    Auto Create Diagram Options

1. Simple

Generate a class diagram without Attributes and Operations inside the classes.
Auto Create Class Diagram in Simple Way

2. Detailed

Generates a class diagram including Attributes and Operations inside the classes.
Auto Create UML Class Diagram

3. Unpack Subpackages

Generates a class diagram with all models, including those in sub-packages if present.
Unpack SubPackages

section divider

Class

Creating a Class

There are five ways to create a Class in the Diagram Editor. Refer to the Diagram Editor page for more details.
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 hovering over a Class and clicking the orange diamond that appears.
Attribute-diamond

Alternatively, hit the [Enter] key while an attribute is selected to create another.
Creating Attributes

You can also add Attributes by pasting copied text.
Add Operation by text

Attribute Visibility

To show/hide attributes,
1. Open the [Initial Visibility] tab in the bottom-left pane.
2. Select the options and click [Apply to existing elements] to apply them to the diagram.
Initial Visibility in Class Diagram

section divider

Operations

You can create Operations by hovering over a Class and clicking the green bar that appears.
Green bar to add operations

Another way is to press the [Enter] key while an operation is selected.
Methods to Class

Moving Attributes/Operations

Attributes and operations can be moved by dragging them within a class or to another class.
Moving attributes

Since version 8.5, you can add Operations by pasting copied text.

Add Operation by text

section divider

Anonymous Bound Class

You can create an anonymous bound class by deleting the name of a 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 bound 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. Right-click and select [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

section divider

Nest a Class

You can nest a class within a package by dragging it into the package.
Nested Class


Enumerations

Since version 10.0, creating Enumerations is simpler:

1. Choose [Enumeration] from the Class drop-down menu on the tool palette.
Enumeration

2. Click on a diagram editor to place it.
Enumeration_created


Enumeration Literals

There are three ways to create Enumeration Literals.

1. Using Draw Suggest:
Hover over and Enumeration and click the purple mini bar to add a new enumeration literal.
Adding Enumeration Literals by Draw Suggest


2. Using Context Menu:
Right-click on an Enumeration and select [Add Enumeration Literal].
Enumeration Literal

3. From Property view:
Select an Enumeration, then in the property view(bottom-left pane), click [Enumeration Literal] tab and click [+].
Adding Enumeration Literal from Property View

section divider

Association

To create associations, hover over a Class, select the appropriate association type from the icons, and click the target models. For more details, see the “Drawing Lines” section.
Create Associations via Draw Suggest


Jump to Association Ends

You can navigate to the Association ends by right-clicking the association line and selecting [Move to related element].
Move to Related Element

Relocating Association Names

If association names drift from the line, right-click the line and select [Init Label Position] to reset the label’s position.

Bring association name back