PlantUML:クラス図
クラス図(class diagram)
PlantUML:class diagram
PlantUML
元ネタ PlantUMLでクラス図を描く
https://plantuml-proxy.vercel.app/svg/https://scrapbox.io/api/code/suto3/PlantUML:クラス図/fig01.pu#.svg
code:fig01.pu
@startuml
title 単純なクラス図
class "クラス名" as OnlyClassBox
note bottom of OnlyClassBox
クラス名だけを記載する場合は、単純な四角形で良い。
PlantUMLの記法では属性欄と操作欄が必ず表示されてしまう。
end note
@enduml
https://plantuml-proxy.vercel.app/svg/https://scrapbox.io/api/code/suto3/PlantUML:クラス図/fig02.pu#.svg
code:fig02.pu
@startuml
title 属性と操作が記載されたクラス
class "クラス名" as FullSet {
属性(attribute)
書式: "可視性 属性名: 属性のタイプ 多重度 = デフォルト値 { プロパティ文字列 }"
例: "+ name: String 1 = "Untitled" {readOnly}"
"操作(operation)"()
書式: "可視性 操作名(パラメーターリスト) : 戻り値のタイプ {プロパティ文字列}"
例: "+ balanceOn (in date: Date = "2013/02/21") : Money"
}
note bottom of FullSet
属性および操作で必須なのは属性名および操作名のみ。
操作には必ずしも括弧"()"をつける必要はない。
ただし、PlantUMLの記法の場合、属性と操作の区別は括弧 "()" が
あるかないかで行っているため、操作には必ず括弧をつけなければいけない。
endnote
@enduml
chatwork-mobile - /chatwork-mobile/PlantUML でクラス図を書く時のテンプレート
yuzulia-pb - /yuzulia-pb/PlantUML クラス図
PlantUML