0

Is there a standard representation for typed java collections in UML2? I am working on a class diagram and would like to avoid Java syntax, when using something like Map as type for a class attribute.

- foo : Map<Integer, String>
Martin
  • 719
  • 4
  • 11

2 Answers2

3

UML2 has parameterized classes, and the syntax is in fact pretty much the same as Java's - both Java and the UML spec were inspired by the C++ syntax here.

Michael Borgwardt
  • 342,105
  • 78
  • 482
  • 720
2

I'm against using too much design documents to program. Documents are only for communicating ideas, IMHO.

So if you need Java Types for your UML chances are:

  • you are reverse engineering: then Java Syntax will be fine

  • you are trying to program trhough UML: don't do it. Program in Java. Use UML only for object relation and collaboration

    • if the types are primitive: it's likely you don't need to express internal data structures in UML. You only need to express what's the responsibility of the class.
    • if the types are objects: ok, maybe it's the point... I'm not sure, but try to use the minimum...
helios
  • 13,574
  • 2
  • 45
  • 55