The UML supports stereotypes, which are an inbuilt mechanism for logically extending or altering the meaning, display, characteristics or syntax of basic UML model elements. You can apply stereotypes to a range of model element types, including:
- Elements (such as Classes and Objects)
- Relationships (such as Dependencies and Associations)
- Association Ends
- Attributes and Operations
- Operation Parameters
Different model elements have different stereotypes associated with them. You can create and use your own stereotypes in three different ways:
- To create a new object type based on a basic UML model element type, to be imported as part of a Profile into any model and made available for use through the Diagram Toolbox; examples of extended element types already provided in Enterprise Architect include a Table element (which is a stereotyped Class element) and Boundary, Control and Entity elements (which are stereotyped Object elements)
- To customize the appearance or property of an instance of a model element of a specific type; these stereotypes are applied only through the 'Properties' dialog of the object, within the model in which they are created, although you can transport custom stereotype definitions between models as Reference Data
- As a simple label on an element, to identify the role or nature of the object that the element represents
For further definitions of stereotypes, see the OMG UML specification (UML Superstructure Specification, v2.1.1, section 18.3.8, pp. 667-672).
Where a stereotype does not affect appearance, it is generally indicated by name on the base UML object shape. In this example, «myStereotype2» is the stereotype name. Some of the built-in stereotypes are also represented by icons; see Stereotype Visibility.
Where the stereotype causes the element to be drawn differently or is used to define a new type of object, the element shape can be quite different, as illustrated by the three Robustness diagram stereotypes:
You apply a new appearance or shape by associating the stereotype with either a metafile (image file) and fill, border and text colors, or a Shape Script that defines the shape, dimensions and text of the object.