Book a Demo

Author Topic: Association as List or Array  (Read 4257 times)

Jock

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Association as List or Array
« on: June 10, 2004, 02:42:10 am »
I am evaluateing EA (release 4.00.728).
I find ir quite good software, even if it drive me crazy for make an associtaion between two class.
I other word i have Class1  and Class2.
I create an association where Class2 is source and Class1 is taget.
Then I set the association direction "destination to source" (Class1 has a link to Class2).
The on Class2 side I set the multiplicity to 1..0
On Class1 site I specify the role as "linkToClass1" and the access tp "private"

Now, the problem is: when I generate the code (I use Java and Delphi) the link is mapped as M_Class2 instead to use an aggregation like an array or a coillection (List, Set, etc).

What I get is

Class Class1 {

    private Class2 m_Class2;
    ...
}

instaed of


Class Class1 {

    private Class2[]  class2;
    ...
}

Could anybody help me?
Thanks in advance
Jock
« Last Edit: June 10, 2004, 02:44:07 am by Jock »

fluxtah

  • EA User
  • **
  • Posts: 144
  • Karma: +0/-0
    • View Profile
Re: Association as List or Array
« Reply #1 on: June 10, 2004, 04:14:35 am »
Hi,

If you go to tools > options > generation > langauge of your choice there should be a button for collection classes where you can specify what collection object (ArrayList, HashTable) to use as the collection.

I am not to familiar with this functionality at the moment as recently I have been coding only in c# and I ussualy make a  strongly typed collection class for each class in my system and reverse engineer them back into the model.

regards

Fluxtah

Jock

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Association as List or Array
« Reply #2 on: June 10, 2004, 05:50:28 am »
Fluxtah,
thank you for your answer.

I set up the "Collection Classes" as you suggested.
But actuallly the resuilt is still the same with both Java and Delphi.

I really don't understand hoe to deal with that.
It is a pity because EA is quite a good system, I hope this is not a flaw but just a fault of mine.

Thanks
Jock

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Association as List or Array
« Reply #3 on: June 10, 2004, 06:28:42 pm »
According to the help file...

"EA lets you define collection classes for generating code from association links where the target role has a multiplicity setting greater than 1."

http://www.sparxsystems.com.au/EAUserGuide/index.html?settingcollectionclasses.htm

Hope that explains what is going on.

Simon