oopumlprojectmodelio

How do I add Lists in Modelio class diagram?


Using more strict modeling tools (unlike just paint editors) makes you to remember at least basic UML specification.

For example, in the case of modelio, you have to seperately add to the diagram any specific data type which is further used within the class attribute's declaration.

But how do I set a List of objects as a data type? I'm currently using Miltiplicity min and Multiplicity max parameters to set the link multiplicity proprties.

enter image description here

I guess these params are more likely for declaring simple arrays.

enter image description here


Solution

  • In UML, you can specify the multiplicities of a property in order to specify that is a collection. But at the implementation/code level, several collection implementation may correspond to a specific UML model.

    That's why code generator can, usually, be customized to targed one specific code implementation. In Modelio, this customization can be done thanks to the Java tab as depicted below. By default, a Property with "*" as multiplicity max will be generated as an Array. To taget another type of Collection you have to play with the "Collection to use" enumeration and set the one you want.

    enter image description here

    Hoping it helps. EBR