Search code examples
class-diagramplantuml

Two classes with a same name in PlantUML class diagram


Dear community members and PlantUml practitioners,

I would like to have two classes with the same name such as:

  • Test << stereotype >>
  • Test

and I would like to make relation between those two classes. Is it possible to make alias for classes in class diagram so I can make distinction between the classes thus those will be represented as two different elements.

Any idea?


Solution

  • With plantuml you can alias a display name using "as." For class diagrams it looks Like this:

    @startuml
    class "Test" as t1
    class "Test" as t2
    t1 -> t2
    @enduml
    

    As rendered by the online planuml server at http://www.plantuml.com