How to describe a contained map in UML class diagram?

前端 未结 6 1796
迷失自我
迷失自我 2020-12-01 16:10

I have a MyServer class that contains a Map whose keys are MyClientType objects and whose values are MyClient objects. I\'d like to depict this relationship in a class diagr

6条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 16:40

               MyServer
                   |
                   |*
                T1toT2
                /    \
              1/      \1
             Key     Value
    

    The difference to Mark's solution is that the server has a many-relation to the containers. That's also how the Eclipse Modeling Framework (EMF) proposes to implement maps.

    You might also throw in some more UML-specific things, like specifying that the keys have to be unique (through stereotypes).

提交回复
热议问题