Book a Demo

Author Topic: Synchronizing java code to model and associations  (Read 3032 times)

PLANORIT

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Synchronizing java code to model and associations
« on: December 08, 2008, 08:09:40 pm »
Dear all,
I intend to use EA while coding and perform regular synchronization code-> model and vice versa.
If I model for example a bidirectional relationship from
A (1)<---->(1.*) B, EA generates correct Java code like :

public class A {
   List theBroleName;  
}
public class B {
   A roleNameForA;
}

If I touch the Java code for adding methods, for example, then I want to synchronize from Java to model. I have noticed that apart from the asociation link in the diagram, now the model shows in the attributes section the attributes for classes in the association.
If the model shows the association as a visual link (line), isn't it redundant to show the target asociated class as an attribute of the source class and vice versa ?
This leads me to the following question : if I model without reverse engineering, shall i show associations as visual elements or must I also define the asociated class as an attribute? Is it correct to show both?
Thanks and regards,
Planorit.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Synchronizing java code to model and associati
« Reply #1 on: December 09, 2008, 08:57:21 am »
If you're using reverse engineering then EA will always create the attribute, and the association if it can.

There have been plenty of discussions of this around here.  I'm sure you should be able to find a few if you run a search.
« Last Edit: December 09, 2008, 08:57:38 am by simonm »