Book a Demo

Author Topic: Multiplicity and how it is shown on class diagram  (Read 4710 times)

pwillemann

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Multiplicity and how it is shown on class diagram
« on: February 17, 2010, 05:58:09 am »
I'm a little frustrated and the documentation I am reading on this isn't helping me solve my problem.

Here is what I want to do and what I have been unable to do.  I am trying to generate Java code for the below scenario.

I want to have Class A contain a list of Class B.  

I expected to see something like this in the code for Class A

List<ClassB> itemList = new ArrayList<ClassB>  

I have gone to Tools, Options, Collection Classes and set by Default Collection Class to List, but this doesn't seem to help.

I haven't even been able to get the UML diagram to show as I would expect.

Can anyone get me started in the right direction.  Any help would be appreciated.

Thanks
Phil




jkorman

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: Multiplicity and how it is shown on class diag
« Reply #1 on: February 17, 2010, 06:30:00 am »
Try this


Code: [Select]

                     b
[classA] ------------> [classB]
                     0..*
[/font]

Then from the Association Properties set the target end (classB) multiplicity to "0..*" and the Member Type to List<classB>

Jim

pwillemann

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Multiplicity and how it is shown on class diag
« Reply #2 on: February 17, 2010, 07:08:07 am »
I expected a dropdown for List - Are you telling me I have to type it into the field?   I would not expect to have to do that.  Nevertheless my code does not generate correctly.

Thanks