Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HashMap in class diagram (UML)

I build UML 2.0 class diagram for my Java application. In my code I have attribute with HashMap datatype. But, as I know, there is no HashMap datatype in UML standard. The question is - can I use HashMap as datatype for attribute of the class?

UPDATE

maybe in diagram I just should point to java.util package? and maybe place Map class in this package on the diagram?

like image 275
Dmitry Belaventsev Avatar asked Jan 15 '12 08:01

Dmitry Belaventsev


People also ask

What is hashtag in UML?

It indicates a protected member of a class or other data type. - Indicates private.

What are the symbols in UML class diagram?

Pre-drawn UML class diagram symbols represent class, template class, object, item, package, interface, dependency, composition, and association, etc. These symbols help create accurate diagrams and documentation. UML class diagram templates offer you many useful shapes.

How do you show inheritance in a class diagram?

Inheritance is shown in a class diagram by using a solid line with a closed, hollow arrow. Bidirectional association: The default relationship between two classes. Both classes are aware of each other and their relationship with the other. This association is represented by a straight line between two classes.

What is UML class diagrams?

In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among objects.


1 Answers

HashMap should not appear in your UML model anyway. HashMap is just an implementation of a qualified association. Probably it's even just a speed improved unqualified association. So if you had a Class A with a HashMap you would model a UML Class A, a UML Class B and a UML Association from A to B. You can add a qualifier to the association if it's qualified by a key which is not an attribute of B. If your HashMap key is the name of B (and B has that name as an attribute) you would simply omit the qualifier.

To denote the implementation of your Association (you want to implement it with a HashSet) you can add that as a keyword or create a Stereotype for it (more complex).

like image 154
Christian Avatar answered Sep 21 '22 19:09

Christian