Hi Ihab,

Please use the forum for any questions you have in the future: http://forum.andromda.org

In regards to enumeration support, we actually provide support for enumerations by defining a regular UmlClass and stereoyping it as <<Enumeration>> and using the attributes as the literals, we decided to do this because of the fact so few tools have decent support for UML enumerations, as well as the fact that with a UML enumeration you can't supply as much information (like the value of the literal). So anyway, the reason your ${class.literals} returns nothing is because getLiterals() returns the attributes of the class represented as the enumeration.

Chad

Ihab Awad wrote:

Hi folks,

I am using AndroMDA 3.0 to generate Java code using custom templates. My model was originally developed by a third party, but I have modified it extensively, and the modifications were done in MagicDraw 8.0.

The model contains UML enumerations. I need to bind these to an "Enumeration.vsl" template that generates a Java 5 "enum" construct.

My problem is that I cannot seem to successfully bind Enumeration.vsl to the instances of UML enumerations. Here is what I have tried --

  <template path="templates/java/Enumeration.vsl">
    <modelElements variable="class">
      <modelElement>
        <type name="o.a.m.uml.ClassifierFacade">
          <property name="enumeration">true</property>
        </type>
      </modelElement>
    </modelElements>
  </template>

Nothing gets bound to Enumeration.vsl. So I tried the following --

  <template path="templates/java/Enumeration.vsl">
    <modelElements variable="class">
      <modelElement>
        <type name="o.a.m.uml.EnumerationFacade"/>
      </modelElement>
    </modelElements>
  </template>

but encountered the same problem. Finally, just to see if this would help, I created an <<enumeration>> stereotype, attached it all the enumerations in my UML model, and did --

  <template path="templates/java/Enumeration.vsl">
    <modelElements variable="class">
      <modelElement stereotype="enumeration"/>
    </modelElements>
  </template>

and this *did* succeed in invoking Enumeration.vsl for the correct UML model elements. However, in my template, ${class.literals} evaluates as empty, which leads me to wonder if an EnumerationFacade has indeed been constructed, or if a generic ClassifierFacade was constructed instead.

Thanks a lot in advance for any assistance. Peace,

Ihab




------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click _______________________________________________ Andromda-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-user

Reply via email to