Home > Getting Started > Creating a First Diagram


In this section, you will see how to insert new attributes in your classes from the class diagram graphical interface.
You can decide to create two kinds of attribut which are either Java or just model.

If you select java then the Java code will be generated immediately at the attribut creation in your diagram.
If you select Property then only the UML property (e.g. attribut) will be created in your model but not in your code.

To create a new attribute, select New > Attribute > Java Attribute in the class (or interface) contextual menu.

This launches an attribute creation dialog box. You have to set the attribute name, type, multiplicity, default value, visibility and modifiers. For an interface, the attribute is always static final. Please note that it is not anymore possible to immedately add new stereotype at the attribute creation because of runtime model problem. You now need to create an attribute and then once it is created in your UML Editor to click on the attribute > property in order to add a stereotype.

Please note that if you select New > Attribute > UML Property then the accessors option will not be slected because only related to java and not having real need in modeling.

After validating the dialog box, the attribute appears immediately in the class. If you click on the attribute, its code appears in the java editor area and in the UML model.
By default, the getter and setter are displayed. In this example, the attribute is private and is related to its public accessors in the java code.

If we want to use the Property concept, then select a class in the class diagram editor.
Open the pop up menu  >Preferences - Unselect the Show Accessors check box.

The class diagram editor now hides public methods.

< Previous        Next >