6

I have the following generic class header in Java:

class OrganizedGroup <T extends Leader> 

The class represents an organized group. For instance, a music group would have a music leader, an enterprise would have a boss...

How can I represent the condition T extends Leader using UML?

REMARK/EDIT:

There are different so questions that ask about generics and UML. However, my question asks about and additional restriction the parameter should be shown in the diagram as subclass of another class.

user1868607
  • 2,558
  • 1
  • 17
  • 38
  • possible duplicate of [UML Class Diagram and Generics](http://stackoverflow.com/questions/4786771/uml-class-diagram-and-generics) – Pras Sep 02 '15 at 20:45

1 Answers1

9

You would show that as template parameter with a constraint as such:

enter image description here

Note: actually I reverse engineered the class with Enterprise Architect and this is the result.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • The good news: it's affordable and UML2 compliant. The bad news: it's a bit awkward in use. But you can't have everything ;-) – qwerty_so Sep 03 '15 at 11:50