Book a Demo

Author Topic: Class diagram class attribute: list  (Read 4823 times)

ecsgz

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Class diagram class attribute: list
« on: June 09, 2015, 05:59:07 pm »
Hello,

how can I add a list of enums or other class references as an attribute of a class? Example:

--------------
ClassA
--------------
- listofElements: List<ClassB>
--------------

Thank you for the help!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Class diagram class attribute: list
« Reply #1 on: June 09, 2015, 06:45:57 pm »
Not sure which language that is, but generally you set the multiplicity for attributes to anything other than [1].

q.

ecsgz

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Class diagram class attribute: list
« Reply #2 on: June 09, 2015, 07:01:50 pm »
Thanks! How can I model it programming language independent? How to use multiplicity and collection attribute properties correctly, if I want to transform out of the class diagram later code, e.g. to Java or even to a XSD.

Moreover: How to define an attribute to be a map, e.g.
- itemMap: Map<ClassB, ClassC>
« Last Edit: June 09, 2015, 07:09:11 pm by ecsgz »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Class diagram class attribute: list
« Reply #3 on: June 09, 2015, 07:30:23 pm »
Key-Value-Coding can be modeled with an association class.

Syntactical representation of UML elements in a specific language is means of code generators. EA has a build-in generator with a proprietary scripting language (though i prefer to achieve even more using the API and simple file I/O).

q.