Book a Demo

Author Topic: Iterate over Multiple Stereotypes  (Read 2324 times)

Daniel Sirz

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Iterate over Multiple Stereotypes
« on: May 07, 2009, 06:03:55 pm »
Hi there,

How can you iterate over multiple Stereotypes in the Model Transformation or Code Generation?

Example:
Stereotype are "enumeration" and "primary". In this example they are placed on an Attribute.

When i use the "attStereotype"-Macro i only get the first stereotype listed.

How is it possible to get all Stereotypes? I tried the "List" Macro but it didn't work.

Any help is welcome,

Thanks daniel

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Iterate over Multiple Stereotypes
« Reply #1 on: May 08, 2009, 12:57:07 pm »
Hi Daniel,


Gut feeling says you can't. The design in the scripting engine seems to be that an element (or connector) can have one stereotype, but not an arbitrary number.

However, the following might be worth testing:
Instead of using the attStereotype macro, write two separate templates, each as a Stereotyped Override. Give them different names, then in the Class template or wherever you call this template from, call the two templates separately.
This might work (but might not) but will probably result in two copies of each Attribute, which is probably not what you wanted.

Still, the safest bet is to use a single stereotype instead. It might be possible to use multiple inheritance in your Profile if you need both the old stereotypes as well.


/Uffe
My theories are always correct, just apply them to the right reality.

Daniel Sirz

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Iterate over Multiple Stereotypes
« Reply #2 on: May 08, 2009, 06:14:33 pm »
Thank you /Uffe

i will try that.