A stereotype defines how an existing metaclass may be extended. It enables the use of a platform, a domain specific terminology, or a notation in place of, or in addition with, the ones used for the extended metaclass. Similar to a class, a stereotype may have properties which may be referred to as tag definitions. When a stereotype is applied to a model element, the values of the properties may be referred to as tagged values. A stereotype can extend any model element from the reference metamodel (any UML model element). For example in UML, States, Transitions, Activities, Use cases, Components, Attributes, Dependencies, etc. can all be extended with the stereotypes. The stereotypes are created as separate model elements and can be drawn in almost all diagrams. You can specify stereotype properties in the stereotype Specification window. In the same window, you can find the description of each property. Descriptions are presented in the description area of the Specification window.
Stereotype notation in diagrams use the guillemets instead of symbols «» (see the following figure). However, when editing elements in a diagram, you can still enter the stereotype names between the «» symbols.
Creating a stereotype
To create a stereotype, do one of the following
- Open or create the Profile Diagram. On the diagram pallet, click the Stereotype button and place it on the diagram pane.
- In the Containment tree, select a Profile, and from the shortcut menu, select Create Element > Stereotype.
Creating stereotype with an image
To create a stereotype with an image
- In the stereotype's Specification window, click the Icon specification cell to edit and select an image you want to place for the stereotype by selecting an image form:
- the image library, click .
- the file system, click .
- using URL, click .
- Select an image and click the Open button.
- Close the Specification window.
Applying a stereotype
To apply a stereotype, do one of the following:
- In the corresponding element's Specification window, click the Applied Stereotype property specification cell, then click , and select stereotypes from the open list. After you have selected, click Apply.
- In the element's shortcut menu, select Stereotype and select a stereotype that you wish to apply. Click Apply when you are done.
On the diagram pane, select an element and in that element's name area, type the stereotype name between brackets « ». The element's name comes after the stereotype.
If you want to name the element Books and assign it the «table» stereotype, in the element's name area type the following: «table» Books. The name completion for the stereotypes works in the name editing mode, press Ctrl+Spacebar or Ctrl+Backspace to get a list of available stereotypes.
You can change the order of the stereotypes applied to the element. The symbol style of the first stereotype in the list will be applied to the element.
Changing the stereotype’s metaclass
To change the stereotype’s metaclass
- Do one of the following:
- On a diagram pane, select the stereotype and from its smart manipulator toolbar, choose the Metaclass button.
- In the stereotype’s Specification window, click the Metaclass specification value cell, and then click .
- In the Select Metaclass list, select the metaclass you want to apply.
- Click Apply when you are done.
Displaying the stereotype icon instead of the shape on the diagram pane
To display the stereotype icon instead of the shape on the diagram pane
- Select the shape on the diagram and click the Compartments smart manipulator.
- Click to expand the menu and select Suppress All.
View assigned image properties
To view assigned image properties
- In the stereotype Specification window, right-click the Icon property specification cell and select Open Specification. The Image specification window opens wherein you can see and specify image properties.
Changing the order of the stereotypes
If a symbol has several stereotypes applied, you can change the order of stereotypes for visual purposes.
To change the order of the stereotypes
- Right-click the symbol to open the shortcut menu, click Stereotype. The Select Stereotype dialog opens.
- Click the Order button. The Order Stereotypes dialog opens.
- Select a stereotype and click Up or Down buttons to change the order of the stereotypes.
Saving the stereotype information in XMI
You can choose the location of the applied stereotypes' information in the XMI file. Information can be saved at the end of the file or inside the element's information. By default, stereotype information is stored at the end of the XMI file.
To store information inside an element
- From the main menu, select Options > Environment.
- The Environment Options dialog opens.
- In the General options group > Save/Load, set the Save Stereotype Information within Element to true.
Changing the stereotype display mode
You can change the stereotype name and its icon visibility on an element's shape.
To change the stereotype display mode on the element shape
- Click the shape, and then, click buttons to suppress all the compartments.
- Click the shape and then click the Compartments button. From the menu, click the Stereotypes and then select a desired display mode that are described in the following table:
Icon of the
Name of the
Image of the
|Text and icon||displayed||displayed||-|
Shape Image and Text
|Shape Image||-||not displayed||displayed*|
|Do Not Display||not displayed||not displayed||-|
* To display the image of a stereotype instead of the element shape, all element compartments should be suppressed.