How do I make attribute 'List<User> currentlyContains'?


#1

Doesn’t work with list of ints either. What’s the way of using List<> types?

Do I need to create some kind of composition or dependency before I do this? Seems strange because I can add a User as an attribute without any relationship with the User class.


#2

There isn’t really a way. Well, not directly. The UML specification doesn’t allow for X<Y> type of attributes, therefor this isn’t supported by Visual Paradigm. Always keep in mind that Visual Paradigm strictly follows the specifications as set out by the OMG group. Thing is: UML is supposed to be indifferent of programming language and this construct is directly tied into some of those, Java and C# notably but not so much for, say, PHP, Javascript and Perl (note: best guess. I don’t know these last languages inside-out so I could be making a mistake here!).

Essentially an attribute of type List is basically a “nested” array. An array of arrays so to speak. And UML does have an answer to that with multiplicity.

For example:

list_type

But do keep in mind that you’re entering some pretty complex territory here, depending on your needs of course. Still, this is how I’d approach all this.

Hope this helps!


#3

It should be ‘currentlyContains:List<User>