Book a Demo

Author Topic: import Java code - relationships with Set or List  (Read 5563 times)

SPars

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
import Java code - relationships with Set or List
« on: August 21, 2008, 01:11:08 am »
I have imported some existing code - and there are some relationships between ClassA and ClassB that do not appear correctly - or maybe I simply don't understand the process...

ClassA has a Set (or List) of ClassB shown as:
  private Set<ClassB> classB;

I am not getting any relationship drawing as I would expect to see.  I have a
  private ClassC classC;
object, and there is the arrow relationship that gets drawn between ClassA and ClassC.  

Is there a setting that I am not seeing that will give the full relationship?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: import Java code - relationships with Set or L
« Reply #1 on: August 21, 2008, 04:22:37 pm »
EA can model the associations you are describing through use of collection classes (http://www.sparxsystems.com/EAUserGuide/index.html?settingcollectionclasses.htm)  These set how relationships with multiplicity greater than one are generated and can be specified for each language or all associations to individual classes.  For associations where the multiplicity is one, you can only set this by setting the Member Type on the association.

EA currently only creates associations and dependency relationships from code where it finds that a type used in one class directly matches the name of another class.  It currently does not look at the types used as template/generic arguments or attempt to distinguish between when the template class itself should be the target of an association, or if it is acting as a container.

We plan on addressing these limitations and adding the capability of reverse engineering an association or dependency to the class used in a containing template.  However, at this stage the details of this or a release schedule are unavailable.

If you wish to send further enquiries about this issue you contact Sparx Systems support directly.

Teman

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: import Java code - relationships with Set or L
« Reply #2 on: August 23, 2008, 07:10:17 pm »
 :)

David Boaz

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: import Java code - relationships with Set or L
« Reply #3 on: September 21, 2008, 10:55:42 pm »
Hi Sparx experts,

We have encountered the same issue. But we did not understand the answer. Is it possible to configure EA to recognize List<T> as a collection of T? We tried to configure this feature in the Java collection class tab:
default collection class = java.util.List<#TYPE#>
But unfortunately, EA doesn't draw an association.

If this feature is not supported, can you please suggest a workaround? We have plenty of existing classes that are written using generics collections - and cannot be properly displayed.

Thanks for the help, David