Author Topic: Code gen: packages, multi-class files  (Read 1326 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1297
  • Karma: +95/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Code gen: packages, multi-class files
« on: July 19, 2007, 04:09:57 pm »
Hey people!

I'm creating UML profiles and code generation templates for various nefarious purposes. There's a couple of things I don't get, or just can't do properly:

1) Packages. It seems the %packagePath% always comes out the same as the %packageName%, even if the class being generated is three levels into a hierarchy. It seems that only the View level package is actually translated into a %packageName%. What am I missing?

2) Multi-class files. I'd like to generate all classes in a package into one and the same file, but when I specify the same file name for the classes they end up overwriting each other. Ideally, I'd like to be able to generate a whole hierarchy of packages into one file. Considering that there's no %package% template hook, is this possible? Are there any plans to incorporate a %package% hook in a future version?

All help appreciated.

Cheers,


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

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6830
  • Karma: +65/-7
    • View Profile
Re: Code gen: packages, multi-class files
« Reply #1 on: July 19, 2007, 06:24:53 pm »
1) You're not listing over the namespaces so the current package is always the top level package.

2) Use the package generation dialog.  This will generate all classes to any file in one go.
Eve

support@sparxsystems.com

Uffe

  • EA Practitioner
  • ***
  • Posts: 1297
  • Karma: +95/-8
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Code gen: packages, multi-class files
« Reply #2 on: July 19, 2007, 08:06:37 pm »
Hi again,

Thanks for that, works like a charm.
However, I noticed that part of the problem was the fact that some of my packages only contain other packages, no classes.
These classless packages seem to be ignored in the generation process; the Namespace template only produces output for packages with classes (although a subpackage of a childless package is processed).

Any hints?

Cheers,


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

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6830
  • Karma: +65/-7
    • View Profile
Re: Code gen: packages, multi-class files
« Reply #3 on: July 22, 2007, 12:45:21 pm »
EA transforms and code generation work on a set of elements and the packages that contain them.  You can't get packages into a transform without them containing at least one element.
Eve

support@sparxsystems.com