Altova UModel 2024

How to Work with Stereotypes and Tagged Values

Inicio Anterior Inicio Siguiente

Stereotypes and tagged values are quite complex as defined in the UML Superstructure Specification. UModel has simplified their handling and treats them similar to IUMLInstanceSpecifications and IUMLSlots in UML. In the following sample, the stereotype "attributes" is applied to "Class1", and the tag definition "sections" has the tagged values "Value1" and "Value2":

StereotypeTaggedValues

UModel API introduces IUMLStereotypeApplications and maps the sample above to the following UMLData structure:

Object model UMLData Stereotypes

Applying stereotypes and setting tagged values using the UModel API is quite simple:

 

IUMLStereotype iStereotypeAttributes = ...;
IUMLProperty iTagDefSections = ...;
IUMLClass iClass = ...;
 
IUMLStereotypeApplication iStereotypeApp = iClass.ApplyStereotype(iStereotypeAttributes);
iStereotypeApp.SetTaggedValueAt(-1, iTagDefSections, "Value1");
iStereotypeApp.SetTaggedValueAt(-1, iTagDefSections, "Value2");

 

See also the section Predefined UModel elements for information about dealing with predefined stereotypes, tag definitions and tagged values.

 

© 2017-2023 Altova GmbH