Please enable JavaScript to view this site.

Altova UModel 2022 Professional Edition

UModel Programmer's Reference > The UModel API > How to...

How to Use Predefined UModel Elements

Scroll Home Prev Top Next More

UModel defines several important elements as "predefined". This includes several internal elements (Root, Component View and Unknown Externals package) as well as the elements of all profiles installed with UModel (e.g. the C#, VB and Java profile).


Predefined elements can be uniquely identified by using ENUMUMLPredefinedElement, which allows direct and easy access to these elements for several functionalities, for example:


Find a predefined element:


// get the CSharp profile
IUMLProfile iCSharpProfile = (IUMLProfile) iDoc.RootPackage.FindPredefinedOwnedElement(ENUMUMLPredefinedElement.ePredefined_CSharp_Profile, false);


Apply a predefined stereotype:


// set the CSharp 'delegate' stereotype
iClass.ApplyPredefinedStereotype( ENUMUMLPredefinedElement.ePredefined_CSharp_delegateStereotypeOfClass );


Check if a predefined stereotype is applied:


// check if package is a CSharp - namespace (if 'namespace' stereotype is applied)
bool bIsCSharpNamespace = iPackage.IsPredefinedStereotypeApplied( ENUMUMLPredefinedElement.ePredefined_CSharp_namespaceStereotypeOfPackage );


Set the tagged value of a predefined tag definition:


// set attribute-section "STAThread"
// ...
iStereotypeApp.SetPredefinedTaggedValueAt(-1, ENUMUMLPredefinedElement.ePredefined_CSharp_attributesStereotypeOfClass_sectionsProperty, iSTAThread.Name);

© 2015-2021 Altova GmbH