fig01.pu@startuml
title 単純なクラス図
class "クラス名" as OnlyClassBox
note bottom of OnlyClassBox
クラス名だけを記載する場合は、単純な四角形で良い。
PlantUMLの記法では属性欄と操作欄が必ず表示されてしまう。
end note
@enduml
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