Profile diagrams: stereotypes and metadata
简介 / Introduction
Stereotypes extend class diagram elements with semantic labels, distinguishing roles like “interface”, “service”, “entity”, and “enum” within the same diagram. Both PlantUML and Mermaid support <<stereotype>> notation, but with different details. This post compares syntax and rendering output.
PlantUML version
1 | @startuml |
PlantUML’s profile block declares a namespace for stereotypes, and < <type> > annotations follow the class name directly. Common stereotypes like <<entity>>, <<service>>, and <<interface>> can be styled via skinparam directives.
Mermaid version
1 | classDiagram |
In Mermaid, <<stereotype>> appears as the first line inside a class block, equivalent to PlantUML’s < <type> > annotation. The classDiagram notation supports <<interface>>, <<abstract>>, <<service>>, and other common stereotypes.
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Declaration position | After class name as < <type> > |
Inside class block as first line <<type>> |
| Profile block | Supported via profile {} |
Not supported |
| skinparam styling | Full control over font/color | Themed via CSS |
| Relationship arrows | --, ..>, `< |
–` |
小结 / Wrap-up
Both engines share the same core concept — <<type>> denotes a stereotype — but PlantUML adds profile declarations and skinparam fine-tuning for complex enterprise建模. Mermaid wins on lightweight, Markdown-friendly authoring for inline documentation.
- Title: Profile diagrams: stereotypes and metadata
- Author: puml.online
- Created at : 2026-10-21 09:00:00
- Updated at : 2026-10-21 01:07:06
- Link: https://puml.online/blog/profile-diagram-stereotypes-en/
- License: This work is licensed under CC BY-NC-SA 4.0.