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 diagram but I can't figure out a clean way to do that.
A UML diagram is a diagram based on the UML (Unified Modeling Language) with the purpose of visually representing a system along with its main actors, roles, actions, artifacts or classes, in order to better understand, alter, maintain, or document information about the system.
The plus signs indicate the means you must use to interact with the properties and methods of the class. In other words, the Public items of a class define the interface for the class object and how you must interact with it.
You can use a qualified association:
┌──────────┐ 1 ┌───────┐ │ MyServer │Key│───────────│ Value │ └──────────┘ └───────┘
See: http://etutorials.org/Programming/UML/Chapter+6.+Class+Diagrams+Advanced+Concepts/Qualified+Associations/ (cause it is hard to draw using ASCII)
Note also that a qualified association changes the multiplicity:
┌──────────┐ 0..* ┌───────┐ │ MyServer │───────────────│ Value │ └──────────┘ └───────┘ ┌──────────┐ 1 ┌───────┐ │ MyServer │Key│───────────│ Value │ └──────────┘ └───────┘
The top illustrates an association from a server to 0-n values. By contrast, the qualified association says that any given key will be associated with only one value, and that you can't have a key an absent value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With