Please enable JavaScript to view this site.

Altova UModel 2020 Professional Edition

How to Model...

Stereotypes and Tagged Values

Scroll Home Prev Top Next More

A stereotype is an extension mechanism; it is intended as a flexible way to extend an existing UML element and capture some aspect of it that standard UML doesn't. Stereotypes applied to an element signify that that element has some special use. The UModel built-in profiles (C#, Java, VB.NET, and so on) contain all the stereotypes required to model projects in the respective languages. However, you can also create your own profiles (and their respective stereotypes), see Creating and Applying Custom Profiles.

 

When you import source code or binaries into the model, UModel applies stereotypes to elements automatically, based on the structure of the original code. For example, if annotations modifiers exist in the imported Java source code, the corresponding elements in the model get the «annotations» stereotype. For information about how various language constructs map to UModel elements and become stereotypes in the model, see UModel Element Mappings.

 

You can also apply stereotypes to elements manually, while modeling them. For example, you can apply the «attributes» stereotype to a C# class, which would indicate that the class must be decorated with attributes in generated code. To specify the attribute values in the generated code, you can add so-called "tagged values" in UModel, as shown in Applying Stereotypes. Stereotypes are also used extensively in XML schema modeling, to model elements such as simple types, complex types, facets, and so on. Likewise, stereotypes are used in database modeling, to model elements such as tables, columns, indices, and so on, see Designing Database Objects.

 

Across the UModel graphical interface, stereotypes are displayed enclosed within guillemets (for example, «static»). All stereotypes included into the built-in UModel profiles appear in the Properties window when you click an element. For example, clicking a Java class in the Model Tree would display in the Properties window only class stereotypes applicable to the Java profile (in this example, «annotations», «static», «strictfp»).

um_stereotypes_01

In class diagrams, stereotypes are visible above the name of the class. For example, the class below has the «attributes» stereotype applied to it.

um_stereotypes_02

In case of methods or properties, stereotypes are displayed inline, like the «constructor» stereotype applied to the Account() method in the class above.

© 2019 Altova GmbH