Book a Demo

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

Prev Next

Define Creation of Instance

A stereotyped element can be the classifier of instances created from it. You can define how an instance is created from that stereotyped element, by adding special attributes to the defining Stereotype. The attributes modify the text on the 'Paste As' dialog that displays when a stereotyped element is dragged out of the Browser window onto a diagram.

Attributes

This example from SysML shows the definition of any instances of a SysML Block element that might be created.

A UML Profile diagram showing how to define an instance type for a Class stereotype, in Sparx Systems Enterprise Architect.

When a user drags a SysML Block element from the Browser window onto a diagram, the system checks the _instanceType attribute value and searches the SysML Profile for an element template with a matching _metatype attribute value, and generates the instance from that. With the example definition you would get a Block element with the «property» stereotype.

Attribute

Meaning

See also

_instanceMode

Deprecated

Changes the second option for the 'Paste as' field on the dialog to either:

  • Instance (<element type>) or
  • Property (Object)

The text is determined by the value ('Instance' or 'Property') of the attribute's 'Initial Value' field.

If the attribute is not applied, the option defaults to 'Instance'.

_instanceOwner

Deprecated

Modifies the second option of the 'Paste as' field on the dialog to:

  • as Instance of <element type>

The text is determined by the value of the attribute's 'Initial Value' field, such as 'Block'.

If the attribute is not applied, the option defaults to 'Element'.

_instanceType

Modifies the second option of the 'Paste as' field on the 'Paste as' dialog to:

  • as Instance of Element (ProfileName::<<stereotype>>)

The <<stereotype>> value is defined in the 'Initial Value' field of the attribute, and corresponds to the metatype given to the stereotyped element using the '_metatype' attribute.

Note that you can define the creation of an instance using either the _instanceType attribute or a metaconstraint. The differences are:

  1. In the 'Paste As' dialog, metaconstraints allow you to define multiple instance stereotypes, which _instanceType does not. The multiple instances are all listed; which is a very useful feature.
  2. Metaconstraints (currently) don't have any effect on the 'Convert to Instance' command, which _instanceType does.
Define a Stereotype as a Metatype Constraints on Meta-Constraint Connector

Learn more