Book a Demo

Author Topic: Issue with classes when generating Java from model  (Read 3291 times)

Code Ferret

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Issue with classes when generating Java from model
« on: October 09, 2009, 03:09:45 am »
Hello all,

  I transformed a PIM to a PSM (Java) and then generated the code successfully.  EA generated a *.java file for each EA model package, and some classes have their own *.java files.

  However, my Java coder has a problem with the code; some child classes are defined internally within the parent class, in the same file, making them part of the same java package.

  This is a problem since it means that all of these java classes are now internal and cannot be referenced by external java classes (classes in other java packages).  

  Is there a way that i can force EA to put each class into its own file? Why did it do this for some classes and not for others?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Issue with classes when generating Java from m
« Reply #1 on: October 09, 2009, 09:26:42 am »
I haven't seen this happen before.  EA doesn't make up filenames of its own accord.  And when it suggests them it always suggests a unique filename for each class.

That suggests to me that at some point the filenames were set in the model by someone.  Maybe by copying an existing class with the filename specified or similar.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Issue with classes when generating Java from m
« Reply #2 on: October 09, 2009, 06:03:41 pm »
You did not create inner classes by any chance? (classes nested in another class)
I can imagine that would result in what you described.

Geert

Code Ferret

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Issue with classes when generating Java from m
« Reply #3 on: October 09, 2009, 08:20:28 pm »
Thanks for the advice, upon examination there were nested classes and that was precisely the problem.  

As Geert wrote, the classes were nested in the model and so of course, EA properly nested them in the java code as well. I just didn't realize what was happening.