Book a Demo

Author Topic: code generation (java) --- creating empty files  (Read 2348 times)

olafk

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
code generation (java) --- creating empty files
« on: August 29, 2005, 04:53:47 pm »
Hi all.

When generating code for a particular package, the templates should only generate code for those classes that have a language of (say) "java". This is particularly useful when wanting to generate only some classes using EA's code generation templates (with the others being generated using other tools, or not at all, or whatever).

Now, this sort-of works... except the non-java classes end up generating empty files; i.e. files with a .java extension but entirely empty content.

I've tried to tweak the templates appropriately, but to no avail --- as I assume that once in the templates, it is too late to avoid creating the file.

Any thoughts? Experiences? Comments?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: code generation (java) --- creating empty file
« Reply #1 on: August 29, 2005, 05:22:46 pm »
Yes, once you are in the template, it is too late.  If you are doing a package generation, how about not selecting the classes that you don't want to generate?

Simon

olafk

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: code generation (java) --- creating empty file
« Reply #2 on: August 29, 2005, 05:29:18 pm »
yes, that would be the work-around. A bit tedious for repeated generations... Of course, I could stick them onto separate diagrams, then select all on that diagram... but then I have diagrams that don't reflect what they need to reflect. But they degenerate into "for-generation-only diagrams".

Ugly. And, as I said, a work-around.

Would seem to me that the tool should not generate empty files... a bug?