Book a Demo

Author Topic: C# generics for multiple relationship support?  (Read 4948 times)

tmanthey

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
C# generics for multiple relationship support?
« on: November 12, 2010, 01:06:29 am »
Hi,

I would like to see that a multiple relationship generates a
List<LinkedClass> linkedClass member.

How can I do that?

Thanks,
Tobias


tmanthey

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: C# generics for multiple relationship support?
« Reply #2 on: November 12, 2010, 09:43:18 pm »
Quote
See http://www.sparxsystems.com/enterprise_architect_user_guide/8.0/software_development/settingcollectionclasses.html

I followed the link but I could not see any information on how to handle Generics or "typed List". Can you give me another hint?

mtjakobczyk

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: C# generics for multiple relationship support?
« Reply #3 on: December 16, 2010, 05:08:10 am »
Hello there,
there is a bug in EA 8 (build 864).
The #TYPE# trick from:
http://www.sparxsystems.com/enterprise_architect_user_guide/8.0/software_development/settingcollectionclasses.html
works only when set in:
Tools | Options | Source Code Engineering | JAVA/C# | Collection Classes

Mike

dhaynes

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: C# generics for multiple relationship support?
« Reply #4 on: December 21, 2010, 11:04:32 am »
Quote
Quote
See http://www.sparxsystems.com/enterprise_architect_user_guide/8.0/software_development/settingcollectionclasses.html

I followed the link but I could not see any information on how to handle Generics or "typed List". Can you give me another hint?

Same here, not helpful for me. I'm probably ignorant of the proper terminology but even following the link and experimenting for 15 minutes I'm not able to generate Java code where an attribute like
 
"List<int>listOfInts;"

It always just generates "int listofInts".

I've tried every combination of multiplicity, specifying it's a collection etc. but it always generates "int listOfInts".

Likewise I'd like to know if there is a way to modify whatever template is used so that it will generate something like:

"final List<int>listOfInts = new ArrayList<int>();

I've done multiple searches of forums and manuals and I don't find anything helpful.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C# generics for multiple relationship support?
« Reply #5 on: December 22, 2010, 08:30:17 am »
Since you're wanting a list of int, the only way the linked page will apply is if you have a class in your model called int.  You would then set up an association to that class and have collection classes set up.

Regarding the change of template, I was going to say how to change your template, but then I realised the type being created doesn't match the type of the variable.  Where do you propose specifying that difference?