Add Stereotypes and Metaclasses

When you are extending the UML to develop a domain-specific toolset, you start by creating a Profile Package for the stereotypes you intend to customize. This Package has at least one child Class diagram, and it is on this child diagram that you specify:

·The types of object that you are extending, represented by Metaclass elements, and
·The way in which each object is extended, represented by Stereotype elements


You can qualify the effect of a Stereotype on a Metaclass using a range of other tools, including:

·Shape Scripts in the Stereotype
·Tagged Values, defined by attributes in the Stereotype element
·Structured Tagged Value Classes, defined using attributes in the Stereotype element
· Enumerations, defined using attributes in the Stereotype element
·Tagged Value connectors, to identify possible values for a Tagged Value in an element generated with a Stereotype
·Constraints on the Stereotype element
·Special attributes, that define specific default behavior of stereotyped elements, such as the initial size and color of the element
·Modifying the default appearance of the Stereotype element

Add Metaclasses and Stereotypes to a Profile



See also


Open the child diagram of the Profile Package.


Create a Profile Package



Drag the Metaclass element from the Profile page of the Toolbox onto the diagram.

The Extend Metaclass dialog displays, listing the types of object you can extend, namely:

·Core UML elements, and attributes and operations
·Core connectors
·Abstract metatypes such as Action types, ConnectorEnd and Gate, and

On the Core Elements tab, you can include the set of system-defined extended elements such as ActivityRegion, Change and User, by selecting the Include Extended checkbox.

On the Stereotypes tab, to specify the technology containing the stereotypes that you want to extend,  click on the drop-down arrow in the top field and select the technology name.










Create Stereotypes Extending non-UML Objects



Scroll through the selected list and tick one or more object types that you want to extend.

If you want to select all objects on a tab, click on the All button.




Click on the OK button.

For each checkbox that you have selected, a new Metaclass element is created on the diagram.




Drag a Stereotype element from the Toolbox onto the diagram.

If the Properties dialog does not display, double-click on the element on the diagram.




In the Name field, type a name for the stereotype.




Click on the OK button.




Click on the Extension relationship in the Toolbox and drag the connection from the Stereotype element to the Metaclass element that it will extend.




Your diagram now resembles the one shown below:





Optionally, you can now add to your Stereotype element:

·Stereotype tags
·Enumeration tags
·Structured Tagged Values
·Tagged Value connectors
·Special attributes
·Constraints and/or
·Shape Scripts

You can also define the default appearance of the element or connector as required.

Define Stereotype Tagged Values

Add An Enumeration to a Stereotype

Define a Structured Tagged Value

Use the Tagged Value Connector

Special Attributes

Define Stereotype Constraints

Add Shape Scripts

Set Default Appearance



·If you intend to extend a large number of model elements, rather than putting all of them on one diagram you can create additional child Class diagrams under the Profile Package and add different types of Metaclass elements to different diagrams; in this case you save the Package as the Profile, not the individual diagrams
·If you want to have a stereotype extending more than one metaclass, create one Stereotype element with an Extension connector to each of the Metaclass elements, as shown below:
·Stereotype elements must have unique names, but Metaclass elements can have the same name (for example, there can be several Action Metaclasses, each with a different ActionKind attribute)

Learn more

Learning Center topics

·(Alt+F1) | Enterprise Architect | Modeling Languages | Build a Profile | Create a New Stereotype