Question & Answer
Question
How do you set the type of a tag to a specific meta class using the Application Programming Interface (API) for IBM Rational Rhapsody?
Cause
You have tried using setMetaclass and found that it does not set the type of the tag to a specific metaclass.
Answer
You must use th method setDeclaration(string declaration) to set the type of the tag to a specific metaclass.
The method setMetaclass(string tagMetaClass) sets the metaclass type that the tag should be applicable to, not the type of the actual tag itself. The IRPTag interface inherits the method setDeclaration(string declaration) from the IRPVariable interface.
For example:
IRPTag tag = (IRPTag) flow.addNewAggr("Tag", "realization");
tag.setTagMetaClass("Link");
This will create a tag applicable to Link model elements, but the tag will default to type of string.
Instead we should use setDeclaration(string declaration) to set the tag's type:
IRPTag tag = (IRPTag) flow.addNewAggr("Tag", "realization");
tag.setDeclaration("Link");
Product Synonym
Rational Rhapsody
Was this topic helpful?
Document Information
Modified date:
27 May 2022
UID
swg21672532