Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Michal K on May 21, 2013, 11:01:27 pm

Title: Code generation of classes in a single file
Post by: Michal K on May 21, 2013, 11:01:27 pm
Hi,
Is there a possibility to generate code for multiple classes in a single file - similar to how XSD schema is generated.
We need to generate OData EDM descriptor from our class model.
Thanks,
Michal
Title: Re: Code generation of classes in a single file
Post by: Makulik on May 22, 2013, 12:17:16 am
You can't unless you define a stereotype for a pseudo package class element that contains the classes you want to generate code for as nested elements. If you do so, you can provide code generation templates that write just one file for your pseudo package class.

HTH
Günther
Title: Re: Code generation of classes in a single file
Post by: DanG83616 on May 22, 2013, 01:43:16 am
When I specify the filename attribute to be the same, all the classes are generated into the same file. However, I'm using C++ so perhaps the built-in behavior of the generator is different from language to language.

Title: Re: Code generation of classes in a single file
Post by: Michal K on May 22, 2013, 02:23:49 am
Quote
You can't unless you define a stereotype for a pseudo package class element that contains the classes you want to generate code for as nested elements. If you do so, you can provide code generation templates that write just one file for your pseudo package class.

That's what I've done. Thank you.

Michal
Title: Re: Code generation of classes in a single file
Post by: Eve on May 22, 2013, 11:04:24 am
If you're using a custom language, use the generate package source code dialog after setting all filenames to the same value.