🎉 Copied!
|
@startuml
abstract abstract
abstract class "abstract class"
annotation annotation
circle circle
() circle_short_form
class class
diamond diamond
<> diamond_short_form
entity entity
enum enum
interface interface
@enduml
|
[Ref. for protocol and struct : GH-1028]
[Ref. for protocol and struct : GH-1028, for exception : QA-16258]
WARNING This translation need to be updated. WARNING
クラス間の関係は次の記号を使用して定義されています :
Type
|
Symbol
|
Drawing
|
Extension
|
<|--
|
|
Composition
|
*--
|
|
Aggregation
|
o--
|
|
-- を .. に置き換えると点線にできます。
これらのルールを知ることで、以下の図面を描くことができます:
🎉 Copied!
|
@startuml
Class01 <|-- Class02
Class03 *-- Class04
Class05 o-- Class06
Class07 .. Class08
Class09 -- Class10
@enduml
|
🎉 Copied!
|
@startuml
Class11 <|.. Class12
Class13 --> Class14
Class15 ..> Class16
Class17 ..|> Class18
Class19 <--* Class20
@enduml
|
🎉 Copied!
|
@startuml
Class21 #-- Class22
Class23 x-- Class24
Class25 }-- Class26
Class27 +-- Class28
Class29 ^-- Class30
@enduml
|
: にテキストを続けることによって、関係へラベルを追加することが可能です。
多重度を示す為に関係のそれぞれの側にダブルクォーテーション"" を使うことができます。
🎉 Copied!
|
@startuml
Class01 "1" *-- "many" Class02 : contains
Class03 o-- Class04 : aggregation
Class05 --> "1" Class06
@enduml
|
ラベルの最初または最後に< か > を使って、他のオブジェクトへの関係を示す矢印を追加できます。
🎉 Copied!
|
@startuml
class Car
Driver - Car : drives >
Car *- Wheel : have 4 >
Car -- Person : < owns
@enduml
|
クラス(または列挙型...)の表示に文字以外を使用したい場合は、次のいずれかの方法ですることができます:
- クラス定義にはキーワード
as を使用する
- クラス名の前後に引用符
"" を入れる
🎉 Copied!
|
@startuml
class "This is my class" as class1
class class2 as "It works this way too"
class2 *-- "foo/dummy" : use
@enduml
|
Also note that names starting with ``$`` are valid, but to assign an alias to such element the name must be put between quotes ``""``.
WARNING This translation need to be updated. WARNING
: に続けてフィールド名やメソッド名を記述すると、フィールドやメソッドを宣言できます。
システムは括弧をチェックしてメソッドとフィールドのどちらなのかを選択します。
🎉 Copied!
|
@startuml
Object <|-- ArrayList
Object : equals()
ArrayList : Object[] elementData
ArrayList : size()
@enduml
|
波括弧 {} を使って、フィールドやメソッドをくくることもできます。
構文はタイプや名前の順番について非常に柔軟であることに注意してください。
🎉 Copied!
|
@startuml
class Dummy {
String data
void methods()
}
class Flight {
flightNumber : Integer
departureTime : Date
}
@enduml
|
{field} や {method} 修飾子を用いれば、構文によりフィールドやメソッドだと通常は解釈されるものを強制的に変更することができます。
🎉 Copied!
|
@startuml
class Dummy {
{field} A field (despite parentheses)
{method} Some method
}
@enduml
|
メソッドやフィールドを定義するときに対応する項目の可視性を定義する記号を使用することができます。
文字
|
フィールドのアイコン
|
メソッドのアイコン
|
可視性
|
-
|
|
|
private
|
#
|
|
|
protected
|
~
|
|
|
package private
|
+
|
|
|
public
|
🎉 Copied!
|
@startuml
class Dummy {
-field1
#field2
~method1()
+method2()
}
@enduml
|
コマンド skinparam classAttributeIconSize 0 を使用してこの機能を切ることができます。
🎉 Copied!
|
@startuml
skinparam classAttributeIconSize 0
class Dummy {
-field1
#field2
~method1()
+method2()
}
@enduml
|
WARNING This translation need to be updated. WARNING
静的または抽象的なメソッドまたはフィールドは {static} または {abstract} 修飾子を使用することで定義することができます。
これらの修飾子は行の始めまたは終りに使用することができます。
{static} の代わりに {classifier} もまた使用できます。
🎉 Copied!
|
@startuml
class Dummy {
{static} String id
{abstract} void methods()
}
@enduml
|
デフォルトでは,メソッドやフィールドは PlantUML によって自動再編成されます。メソッドやフィールドに独自の順序付けを定義するためのセパレータを使用できます。以下のセパレータが使用できます: -- .. == __
セパレータ内でタイトルを使用することもできます:
🎉 Copied!
|
@startuml
class Foo1 {
You can use
several lines
..
as you want
and group
==
things together.
__
You can have as many groups
as you want
--
End of class
}
class User {
.. Simple Getter ..
+ getName()
+ getAddress()
.. Some setter ..
+ setName()
__ private data __
int age
-- encrypted --
String password
}
@enduml
|
ステレオタイプは、キーワード class に << と >> で定義されます。
注釈の定義には、キーワード note left of , <code>note
right of</code>, note top of , note bottom of も使用できます。
クラス定義の最後には note left , note right ,
note top , note bottom も使用できます。
注釈は、キーワード note とで単独に定義することができ、記号 .. を使用して他のオブジェクトとリンクすることもできます。
🎉 Copied!
|
@startuml
class Object << general >>
Object <|--- ArrayList
note top of Object : In java, every class\nextends this one.
note "This is a floating note" as N1
note "This note is connected\nto several objects." as N2
Object .. N2
N2 .. ArrayList
class Foo
note left: On last defined class
@enduml
|
次のようないくつかの HTML タグを使用することも可能です(Creole表現を参照):
<b>
<u>
<i>
<s> , <del> , <strike>
<font color="#AAAAAA"> or <font color="colorName">
<color:#AAAAAA> or <color:colorName>
<size:nn> to change font size
<img src="file"> or <img:file> : the file must be accessible by the filesystem
また、複数行にまたがる注釈も可能です。
クラス定義の最後には note left , note right ,
note top , note bottom も使用できます。
🎉 Copied!
|
@startuml
class Foo
note left: On last defined class
note top of Foo
In java, <size:18>every</size> <u>class</u>
<b>extends</b>
<i>this</i> one.
end note
note as N1
This note is <u>also</u>
<b><color:royalBlue>on several</color>
<s>words</s> lines
And this is hosted by <img:sourceforge.jpg>
end note
@enduml
|
フィールド(フィールド、属性、メンバー)またはメソッドに注釈を追加することができます。
⚠ 制限事項
top 、bottom を指定することはできません(left とright のみ実装されています)
- 名前空間の区切り文字列(namespaceSeparator)を
:: に設定した場合、この機能は使えません。
フィールドまたはメンバーへの注釈
🎉 Copied!
|
@startuml
class A {
{static} int counter
+void {abstract} start(int timeout)
}
note right of A::counter
This member is annotated
end note
note right of A::start
This method is now explained in a UML note
end note
@enduml
|
同名のメソッドへの注釈
🎉 Copied!
|
@startuml
class A {
{static} int counter
+void {abstract} start(int timeoutms)
+void {abstract} start(Duration timeout)
}
note left of A::counter
This member is annotated
end note
note right of A::"start(int timeoutms)"
This method with int
end note
note right of A::"start(Duration timeout)"
This method with Duration
end note
@enduml
|
[Ref. QA-3474 and QA-5835]
WARNING This translation need to be updated. WARNING
リンク定義の直後に note on link を使用して、リンクに注釈を加えることが可能です。
もし注釈の相対位置を変えたい場合には、ラベル note left on link , note right on link , note top on link , note bottom on link も使用できます。
🎉 Copied!
|
@startuml
class Dummy
Dummy --> Foo : A link
note on link #red: note that is red
Dummy --> Foo2 : Another link
note right on link #blue
this is my note on right link
and in blue
end note
@enduml
|
抽象クラスは、キーワード abstract または abstract class を使用して宣言できます。
そのクラスは イタリック体 で印字されます。
キーワード interface , annotation と enum も使用できます。
🎉 Copied!
|
@startuml
abstract class AbstractList
abstract AbstractCollection
interface List
interface Collection
List <|-- AbstractList
Collection <|-- AbstractCollection
Collection <|- List
AbstractCollection <|- AbstractList
AbstractList <|-- ArrayList
class ArrayList {
Object[] elementData
size()
}
enum TimeUnit {
DAYS
HOURS
MINUTES
}
annotation SuppressWarnings
annotation Annotation {
annotation with members
String foo()
String bar()
}
@enduml
|
[Ref. 'Annotation with members' Issue#458]
コマンド hide/show を使用して、クラスの表示をパラメータ化できます。
基本のコマンドは hide empty members です。このコマンドは属性やメソッドが空の場合に非表示にします。
empty members の代わりに使用することができます:
empty fields または empty attributes は空のフィールドに、
empty methods は空のメソッドに、
fields または attributes は、それらが記述されていても非表示になります、
methods はメソッドが記述されていても非表示になります、
members はフィールドとメソッドが記述されていても非表示になります、
circle はクラス名の前の丸で囲んだ文字に、
stereotype はステレオタイプに。
キーワード hide または show のすぐ後ろに提供することもできます:
class は全てのクラスに、
interface は全てのインタフェースに、
enum は全ての列挙型に、
<<foo1>> は foo1 でステレオタイプ化されたクラスに、
- 既存のクラス名。
コマンド show/hide をルールや例外の定義にそれぞれ使用することができます。
🎉 Copied!
|
@startuml
class Dummy1 {
+myMethods()
}
class Dummy2 {
+hiddenMethod()
}
class Dummy3 <<Serializable>> {
String name
}
hide members
hide <<Serializable>> circle
show Dummy1 methods
show <<Serializable>> fields
@enduml
|
コマンド show/hide でクラスを非表示にすることができます。
これは大規模なインクルードファイルを定義する場合で、ファイルのインクルードの後でいくつかのクラスを非表示にしたい場合に有用である可能性が有ります。
🎉 Copied!
|
@startuml
class Foo1
class Foo2
Foo2 *-- Foo1
hide Foo2
@enduml
|
コマンド remove でクラスを削除することができます。
これは大規模なインクルードファイルを定義する場合で、ファイルのインクルードの後でいくつかのクラスを削除したい場合に有用である可能性が有ります。
🎉 Copied!
|
@startuml
class Foo1
class Foo2
Foo2 *-- Foo1
remove Foo2
@enduml
|
You can put $tags (using $ ) on elements, then remove, hide or restore components either individually or by tags.
By default, all components are displayed:
🎉 Copied!
|
@startuml
class C1 $tag13
enum E1
interface I1 $tag13
C1 -- I1
@enduml
|
But you can:
🎉 Copied!
|
@startuml
class C1 $tag13
enum E1
interface I1 $tag13
C1 -- I1
hide $tag13
@enduml
|
- or
remove $tag13 components:
🎉 Copied!
|
@startuml
class C1 $tag13
enum E1
interface I1 $tag13
C1 -- I1
remove $tag13
@enduml
|
- or
remove $tag13 and restore $tag1 components:
🎉 Copied!
|
@startuml
class C1 $tag13 $tag1
enum E1
interface I1 $tag13
C1 -- I1
remove $tag13
restore $tag1
@enduml
|
- or
remove * and restore $tag1 components:
🎉 Copied!
|
@startuml
class C1 $tag13 $tag1
enum E1
interface I1 $tag13
C1 -- I1
remove *
restore $tag1
@enduml
|
デフォルトでは、すべてのクラスが表示されます:
🎉 Copied!
|
@startuml
class C1
class C2
class C3
C1 -- C2
@enduml
|
- しかし、
hide @unlinked で、孤立したクラスを非表示にすることができます:
🎉 Copied!
|
@startuml
class C1
class C2
class C3
C1 -- C2
hide @unlinked
@enduml
|
- もしくは、
remove @unlinked で、孤立したクラスを削除できます:
🎉 Copied!
|
@startuml
class C1
class C2
class C3
C1 -- C2
remove @unlinked
@enduml
|
[Adapted from QA-11052]
括弧 < と > を使用してジェネリクスの使用をクラスに定義できます。
🎉 Copied!
|
@startuml
class Foo<? extends Element> {
int size()
}
Foo *- Element
@enduml
|
この描画はskinparam genericDisplay old コマンドにより非表示にすることができます。
通常、目印文字 (C,I,E,A) は、クラス、インターフェイス、列挙型と抽象クラスのために使用されます。
しかし、つぎの例のように単一の文字と色を追加し、ステレオタイプを定義するクラスに独自の目印を作成することができます:
🎉 Copied!
|
@startuml
class System << (S,#FF7700) Singleton >>
class Date << (D,orchid) >>
@enduml
|
キーワード package を使用してパッケージを定義でき、必要に応じてパッケージの背景色(HTML カラーコードまたは名前)を宣言します。
パッケージ定義は入れ子にできることに注意してください。
🎉 Copied!
|
@startuml
package "Classic Collections" #DDDDDD {
Object <|-- ArrayList
}
package net.sourceforge.plantuml {
Object <|-- Demo1
Demo1 *- Demo2
}
@enduml
|
WARNING This translation need to be updated. WARNING
パッケージに利用可能なさまざまなスタイルがあります。
コマンド skinparam packageStyle を使用してデフォルトのスタイルを設定する、またはパッケージのステレオタイプを使用する、のどちらかで指定することができます。
or by using a stereotype on the package:
🎉 Copied!
|
@startuml
scale 750 width
package foo1 <<Node>> {
class Class1
}
package foo2 <<Rectangle>> {
class Class2
}
package foo3 <<Folder>> {
class Class3
}
package foo4 <<Frame>> {
class Class4
}
package foo5 <<Cloud>> {
class Class5
}
package foo6 <<Database>> {
class Class6
}
@enduml
|
次の例のように、パッケージ間のリンクを定義することもできます:
🎉 Copied!
|
@startuml
skinparam packageStyle rectangle
package foo1.foo2 {
}
package foo1.foo2.foo3 {
class Object
}
foo1.foo2 +-- foo1.foo2.foo3
@enduml
|
パッケージ内では、クラスの名前はこのクラスの一意な識別子です。
それは、全く同じ名前の 2 つのクラスを異なるパッケージに持つことができないことを意味します。
そのような場合、パッケージの代わりに名前空間を使用したらいいでしょう。
名前空間からの完全修飾名によりクラスを参照することができます。デフォルトの名前空間からのクラスは、一つのドットで修飾します。
明示的に名前空間を作成する必要はないことに注意してください:
完全修飾されたクラスは自動的に適切な名前空間に置かれています。
🎉 Copied!
|
@startuml
class BaseClass
namespace net.dummy #DDDDDD {
.BaseClass <|-- Person
Meeting o-- Person
.BaseClass <|- Meeting
}
namespace net.foo {
net.dummy.Person <|- Person
.BaseClass <|-- Person
net.dummy.Meeting o-- Person
}
BaseClass <|-- net.unused.Person
@enduml
|
There won't be any difference between namespaces and packages anymore: both keywords are now synonymous.
WARNING This translation need to be updated. WARNING
コマンド set namespaceSeparator ??? を使用して、(ドット以外の)別の区切り文字を定義することができます。
🎉 Copied!
|
@startuml
set namespaceSeparator ::
class X1::X2::foo {
some info
}
@enduml
|
コマンド set namespaceSeparator none を使用して、自動的に名前空間を作成する機能を無効にすることができます。
🎉 Copied!
|
@startuml
set namespaceSeparator none
class X1.X2.foo {
some info
}
@enduml
|
WARNING This translation need to be updated. WARNING
次の構文を使用して、クラスにロリポップインタフェースを定義することもできます:
bar ()- foo
bar ()-- foo
foo -() bar
🎉 Copied!
|
@startuml
class foo
bar ()- foo
@enduml
|
デフォルトではクラス間のリンクは 2 つのダッシュ -- を持っており、垂直に配向されています。
次のように単一のダッシュ(またはドット)を置くことによって水平方向にリンクを使用することが可能です。
🎉 Copied!
|
@startuml
Room o- Student
Room *-- Chair
@enduml
|
リンクをひっくり返すことにより向きを変えることができます:
🎉 Copied!
|
@startuml
Student -o Room
Chair --* Room
@enduml
|
キーワード left , right , up , down を矢印の内側に置くことにより、矢印の方向を変えることも可能です:
🎉 Copied!
|
@startuml
foo -left-> dummyLeft
foo -right-> dummyRight
foo -up-> dummyUp
foo -down-> dummyDown
@enduml
|
方向の最初の文字を使用して矢印を短縮することができます(例えば、-d- を -down- の代わりに、または、最初の 2 文字
(-do- )。
この機能を悪用してはならないことに注意してください。Graphviz は微調整のいらない良い結果を通常は与えてくれます。
left to right direction パラメータを使用した場合は次のようになります。
🎉 Copied!
|
@startuml
left to right direction
foo -left-> dummyLeft
foo -right-> dummyRight
foo -up-> dummyUp
foo -down-> dummyDown
@enduml
|
この例のように、2 つのクラスの関係を定義した後で 関連クラス を定義することができます。
🎉 Copied!
|
@startuml
class Student {
Name
}
Student "0..*" - "1..*" Course
(Student, Course) .. Enrollment
class Enrollment {
drop()
cancel()
}
@enduml
|
別の方向にそれを定義することができます:
🎉 Copied!
|
@startuml
class Student {
Name
}
Student "0..*" -- "1..*" Course
(Student, Course) . Enrollment
class Enrollment {
drop()
cancel()
}
@enduml
|
🎉 Copied!
|
@startuml
class Station {
+name: string
}
class StationCrossing {
+cost: TimeInterval
}
<> diamond
StationCrossing . diamond
diamond - "from 0..*" Station
diamond - "to 0..* " Station
@enduml
|
[Ref. Incubation: Associations]
ダイアグラムの色やフォントを変更するには skinparam コマンドを使用します。
このコマンドは以下の場面で使用できます。
🎉 Copied!
|
@startuml
skinparam class {
BackgroundColor PaleGreen
ArrowColor SeaGreen
BorderColor SpringGreen
}
skinparam stereotypeCBackgroundColor YellowGreen
Class01 "1" *-- "many" Class02 : contains
Class03 o-- Class04 : aggregation
@enduml
|
ステレオタイプクラスに特定の色やフォントを定義することができます。
🎉 Copied!
|
@startuml
skinparam class {
BackgroundColor PaleGreen
ArrowColor SeaGreen
BorderColor SpringGreen
BackgroundColor<<Foo>> Wheat
BorderColor<<Foo>> Tomato
}
skinparam stereotypeCBackgroundColor YellowGreen
skinparam stereotypeCBackgroundColor<< Foo >> DimGray
Class01 <<Foo>>
Class03 <<Foo>>
Class01 "1" *-- "many" Class02 : contains
Class03 o-- Class04 : aggregation
@enduml
|
WARNING This translation need to be updated. WARNING
# 表記を使用して、クラスや注釈に個別の色を宣言することが可能です。
標準的な色の名前または RGB コードのいずれかを様々な記法で使用することができます。色を参照してください。
次の構文で背景に色のグラデーションを設定することもできます。
2つの色の名前を次のいずれかで区切って記述してください:
グラデーションの方向に応じて記号を使い分けてください。
例:
🎉 Copied!
|
@startuml
skinparam backgroundcolor AntiqueWhite/Gold
skinparam classBackgroundColor Wheat|CornflowerBlue
class Foo #red-green
note left of Foo #blue\9932CC
this is my
note on this class
end note
package example #GreenYellow/LightGoldenRodYellow {
class Dummy
}
@enduml
|
ときには、デフォルトのレイアウトでは完璧とは言えないことがあります…
together キーワードを使って複数のクラスをグループにまとめることができます:
レイアウトエンジンは、それらのクラスを(あたかも同じパッケージにあるかのように)グループにまとめようとします。
hidden リンクを使ってレイアウトを強制することも可能です。
🎉 Copied!
|
@startuml
class Bar1
class Bar2
together {
class Together1
class Together2
class Together3
}
Together1 - Together2
Together2 - Together3
Together2 -[hidden]--> Bar1
Bar1 -[hidden]> Bar2
@enduml
|
時には、ある非常に大きな画像ファイルを受け取ることがあるでしょう。
生成された画像を複数のファイルに分割するコマンド page (hpages)x(vpages) を使用することができます:
hpages は横方向のページ数を示すコマンドであり、
そして vpages は縦方向のページ数を示すコマンドです。
特定のスキンパラメータ設定を使用して、分割されたページに罫線を配置することもできます(例を参照)。
🎉 Copied!
|
@startuml
' Split into 4 pages
page 2x2
skinparam pageMargin 10
skinparam pageExternalColor gray
skinparam pageBorderColor black
class BaseClass
namespace net.dummy #DDDDDD {
.BaseClass <|-- Person
Meeting o-- Person
.BaseClass <|- Meeting
}
namespace net.foo {
net.dummy.Person <|- Person
.BaseClass <|-- Person
net.dummy.Meeting o-- Person
}
BaseClass <|-- net.unused.Person
@enduml
|
extends キーワードとimplements キーワードを使用することができます。
🎉 Copied!
|
@startuml
class ArrayList implements List
class ArrayList extends AbstractList
@enduml
|
線のスタイル
関係(リンク、矢印)にbold 、dashed 、dotted 、hidden 、plain のスタイルを指定することができます。
🎉 Copied!
|
@startuml
title Bracketed line style without label
class foo
class bar
bar1 : [bold]
bar2 : [dashed]
bar3 : [dotted]
bar4 : [hidden]
bar5 : [plain]
foo --> bar
foo -[bold]-> bar1
foo -[dashed]-> bar2
foo -[dotted]-> bar3
foo -[hidden]-> bar4
foo -[plain]-> bar5
@enduml
|
🎉 Copied!
|
@startuml
title Bracketed line style with label
class foo
class bar
bar1 : [bold]
bar2 : [dashed]
bar3 : [dotted]
bar4 : [hidden]
bar5 : [plain]
foo --> bar : ∅
foo -[bold]-> bar1 : [bold]
foo -[dashed]-> bar2 : [dashed]
foo -[dotted]-> bar3 : [dotted]
foo -[hidden]-> bar4 : [hidden]
foo -[plain]-> bar5 : [plain]
@enduml
|
[Adapted from QA-4181]
線の色
🎉 Copied!
|
@startuml
title Bracketed line color
class foo
class bar
bar1 : [#red]
bar2 : [#green]
bar3 : [#blue]
foo --> bar
foo -[#red]-> bar1 : [#red]
foo -[#green]-> bar2 : [#green]
foo -[#blue]-> bar3 : [#blue]
'foo -[#blue;#yellow;#green]-> bar4
@enduml
|
線の太さ
🎉 Copied!
|
@startuml
title Bracketed line thickness
class foo
class bar
bar1 : [thickness=1]
bar2 : [thickness=2]
bar3 : [thickness=4]
bar4 : [thickness=8]
bar5 : [thickness=16]
foo --> bar : ∅
foo -[thickness=1]-> bar1 : [1]
foo -[thickness=2]-> bar2 : [2]
foo -[thickness=4]-> bar3 : [4]
foo -[thickness=8]-> bar4 : [8]
foo -[thickness=16]-> bar5 : [16]
@enduml
|
[Ref. QA-4949]
混合
🎉 Copied!
|
@startuml
title Bracketed line style mix
class foo
class bar
bar1 : [#red,thickness=1]
bar2 : [#red,dashed,thickness=2]
bar3 : [#green,dashed,thickness=4]
bar4 : [#blue,dotted,thickness=8]
bar5 : [#blue,plain,thickness=16]
foo --> bar : ∅
foo -[#red,thickness=1]-> bar1 : [#red,1]
foo -[#red,dashed,thickness=2]-> bar2 : [#red,dashed,2]
foo -[#green,dashed,thickness=4]-> bar3 : [#green,dashed,4]
foo -[#blue,dotted,thickness=8]-> bar4 : [blue,dotted,8]
foo -[#blue,plain,thickness=16]-> bar5 : [blue,plain,16]
@enduml
|
個別の関係ごとに色とスタイルを変更するには、次の記法を使用します:
#color;line.[bold|dashed|dotted];text:color
🎉 Copied!
|
@startuml
class foo
foo --> bar : normal
foo --> bar1 #line:red;line.bold;text:red : red bold
foo --> bar2 #green;line.dashed;text:green : green dashed
foo --> bar3 #blue;line.dotted;text:blue : blue dotted
@enduml
|
[See similar feature on deployment]
個別のクラスごとに色とスタイルを変更するには、次の記法を使用します:
最初に背景色(#color )、次に線の色(##[style]color )を指定します。
🎉 Copied!
|
@startuml
abstract abstract
annotation annotation #pink ##[bold]red
class class #palegreen ##[dashed]green
interface interface #aliceblue ##[dotted]blue
@enduml
|
[Ref. QA-1487]
#[color|back:color];header:color;line:color;line.[bold|dashed|dotted];text:color
🎉 Copied!
|
@startuml
abstract abstract
annotation annotation #pink;line:red;line.bold;text:red
class class #palegreen;line:green;line.dashed;text:green
interface interface #aliceblue;line:blue;line.dotted;text:blue
@enduml
|
例:
🎉 Copied!
|
@startuml
class bar #line:green;back:lightblue
class bar2 #lightblue;line:green
class Foo1 #back:red;line:00FFFF
class FooDashed #line.dashed:blue
class FooDotted #line.dotted:blue
class FooBold #line.bold
class Demo1 #back:lightgreen|yellow;header:blue/red
@enduml
|
[Ref. QA-3770]
🎉 Copied!
|
@startuml
class Foo {
+ field1
+ field2
}
class Bar {
+ field3
+ field4
}
Foo::field1 --> Bar::field3 : foo
Foo::field2 --> Bar::field4 : bar
@enduml
|
[Ref. QA-3636]
🎉 Copied!
|
@startuml
left to right direction
class User {
id : INTEGER
..
other_id : INTEGER
}
class Email {
id : INTEGER
..
user_id : INTEGER
address : INTEGER
}
User::id *-- Email::user_id
@enduml
|
[Ref. QA-5261]
skinparam groupInheritance を使用すると、複数の矢印の矢じりを統合することができます。また、閾値をパラメータとして指定できます。
groupInheritance 1 (グループ化しない)
🎉 Copied!
|
@startuml
skinparam groupInheritance 1
A1 <|-- B1
A2 <|-- B2
A2 <|-- C2
A3 <|-- B3
A3 <|-- C3
A3 <|-- D3
A4 <|-- B4
A4 <|-- C4
A4 <|-- D4
A4 <|-- E4
@enduml
|
groupInheritance 2 (2つ以上の場合にグループ化)
🎉 Copied!
|
@startuml
skinparam groupInheritance 2
A1 <|-- B1
A2 <|-- B2
A2 <|-- C2
A3 <|-- B3
A3 <|-- C3
A3 <|-- D3
A4 <|-- B4
A4 <|-- C4
A4 <|-- D4
A4 <|-- E4
@enduml
|
groupInheritance 3 (3つ以上の場合にグループ化)
🎉 Copied!
|
@startuml
skinparam groupInheritance 3
A1 <|-- B1
A2 <|-- B2
A2 <|-- C2
A3 <|-- B3
A3 <|-- C3
A3 <|-- D3
A4 <|-- B4
A4 <|-- C4
A4 <|-- D4
A4 <|-- E4
@enduml
|
groupInheritance 4 (4つ以上の場合にグループ化)
🎉 Copied!
|
@startuml
skinparam groupInheritance 4
A1 <|-- B1
A2 <|-- B2
A2 <|-- C2
A3 <|-- B3
A3 <|-- C3
A3 <|-- D3
A4 <|-- B4
A4 <|-- C4
A4 <|-- D4
A4 <|-- E4
@enduml
|
[Ref. QA-3193, and Defect QA-13532]
Simple example
🎉 Copied!
|
@startuml
class Class
object Object
json JSON {
"fruit":"Apple",
"size":"Large",
"color": ["Red", "Green"]
}
@enduml
|
[Ref. QA-15481]
For another example, see on JSON page.
[From V1.2023.2+, and V1.2023.5]
🎉 Copied!
|
@startuml
class A.B.C.D.Z {
}
@enduml
|
🎉 Copied!
|
@startuml
set separator none
class A.B.C.D.Z {
}
@enduml
|
🎉 Copied!
|
@startuml
!pragma useIntermediatePackages false
class A.B.C.D.Z {
}
@enduml
|
🎉 Copied!
|
@startuml
set separator none
package A.B.C.D {
class Z {
}
}
@enduml
|
[Ref. GH-1352]
|
|