Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: thomaskilian on May 05, 2006, 06:24:33 am
-
I could not find this in the documentation. How can I get hold of multiple stereotypes via the automation interface? I only found the primary stereotype as a string. Nothing about a collection of stereotypes.
-
I could not find this in the documentation. How can I get hold of multiple stereotypes via the automation interface? I only found the primary stereotype as a string. Nothing about a collection of stereotypes.
They're in:
eaElement.GetStereotypeList()
as a comma separated list (as I recall)
HTH,
Paolo
-
Thanks, Paolo. I'll check that tomorrow :-)
Sparx: This is not documented, is it?
-
Actually I think it is, although if I remember correctly I needed to try it out before the documentation made sense. With the benefit of hindsight the docs improved somewhat...
-
The pointer was right :)
But why a comma separated list? Okay - there's likely no stereotype with a comma inside, but I'd expect a collection for things like that. Am I wrong?
-
The pointer was right :)
But why a comma separated list? Okay - there's likely no stereotype with a comma inside, but I'd expect a collection for things like that. Am I wrong?
No you're not wrong, but then you'd NOT expect two ways of getting one of the stereotypes and one way to get the rest.
It's the EA UI (Unique Interface) again, this time at the automation level.
I suspect the UML specification precludes a comma as a legitimate character in a stereotype name.
Paolo
-
BTW, I think I remember from someplace that if you search on - or otherwise use or expect - the stereotypes to be separated by a 'comma space' pair, you will fail. EA will consider the space to be the first character of the latter stereotype and act accordingly, something you likely do not want.
Given that users or other software may format or expect lists for readability it is often worth running the stereotype lists through something like a regular expression filter in either or both directions.
Just thought I'd save you a bit of hair pulling when the time came.
David
-
Sorry if resurrecting such an old topic annoys people, but I thought this was a genuinely useful one that could do with a little bump.
The method GetStereotypeList is now documented (if it wasn't before?) and certainly works in my javascript.
https://www.sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/element2.html
It's useful to be able to query the full list of stereotypes. Even if it is still implemented as a comma-separated list, rather than a (more standard in EA?) Collection.
Happy for nobody to reply to this. I just see lots of discussions about the challenges of managing/querying multiple stereotypes per Element, and I only found this topic after much googling rather than via any meaningful link in the User Guide :)
-
makes me nostalgic, though...
q.
-
Wow, 2006, that's around the same time I joined this forum, when EA was this new and upcoming modelling tool.
Geert
-
The method GetStereotypeList is now documented (if it wasn't before?) and certainly works in my javascript.
[...]
It's useful to be able to query the full list of stereotypes. Even if it is still implemented as a comma-separated list, rather than a (more standard in EA?) Collection.
And there is Element.StereotypeEx property which returns comma separated list, as well. But only names, not fully-qualified. I don't know whether GetStereotypeList() is any different on this aspect - no info in Sparx help.