Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Contents
Prev Next

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

Step

Description

See also

1

Open the child diagram of the Profile Package.

Create a Profile Package

2

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
  • Stereotypes

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

3

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

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

4

Click on the OK button.

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

5

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.

6

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

7

Click on the OK button.

8

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

9

Your diagram now resembles this example:

10

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.

Add Shape Scripts Special Attributes Set Default Appearance Define Stereotype Constraints Use the Tagged Value Connector Define a Structured Tagged Value Define Stereotype Tagged Values Add An Enumeration to a Stereotype

Notes

  • 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:


  • 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