コンテンツにスキップ
UML
オブジェクト図

オブジェクト図

(Object Diagram)

サンプル

@startuml
object "myCar" as car
car : brand = "Toyota"
car : model = "Prius"
car : color = "Red"
car : owner = "John"

object "myHouse" as house
house : address = "123 Main St"
house : owner = "John"

car -- house : is owned by
@enduml
PlantUML図
PlantUMLソース
@startuml
object "myCar" as car
car : brand = "Toyota"
car : model = "Prius"
car : color = "Red"
car : owner = "John"

object "myHouse" as house
house : address = "123 Main St"
house : owner = "John"

car -- house : is owned by
@enduml

全体の設定

タイトル

タイトルを定義できます。

title 新基盤構築計画
PlantUML図
PlantUMLソース
@startuml
title 新基盤構築計画
object "myCar" as car
car : brand = "Toyota"
car : model = "Prius"
car : color = "Red"
car : owner = "John"

object "myHouse" as house
house : address = "123 Main St"
house : owner = "John"

car -- house : is owned by
@enduml

ヘッダ

ヘッダを定義できます。

header 新基盤構築計画
PlantUML図
PlantUMLソース
@startuml
header 新基盤構築計画
object "myCar" as car
car : brand = "Toyota"
car : model = "Prius"
car : color = "Red"
car : owner = "John"

object "myHouse" as house
house : address = "123 Main St"
house : owner = "John"

car -- house : is owned by
@enduml

フッタ

フッタを定義できます。

footer フッタ
PlantUML図
PlantUMLソース
@startuml
footer フッタ
object "myCar" as car
car : brand = "Toyota"
car : model = "Prius"
car : color = "Red"
car : owner = "John"

object "myHouse" as house
house : address = "123 Main St"
house : owner = "John"

car -- house : is owned by
@enduml

キャプション

キャプションを定義できます。

caption キャプション
PlantUML図
PlantUMLソース
@startuml
caption キャプション
object "myCar" as car
car : brand = "Toyota"
car : model = "Prius"
car : color = "Red"
car : owner = "John"

object "myHouse" as house
house : address = "123 Main St"
house : owner = "John"

car -- house : is owned by
@enduml

すべて組み合わせると…

PlantUML図
PlantUMLソース
@startuml
header 新基盤構築計画
title 新基盤構築計画
caption キャプション
footer フッタ
object "myCar" as car
car : brand = "Toyota"
car : model = "Prius"
car : color = "Red"
car : owner = "John"

object "myHouse" as house
house : address = "123 Main St"
house : owner = "John"

car -- house : is owned by
@enduml

オブジェクト

オブジェクトを定義できます。

object myCar
PlantUML図
PlantUMLソース
@startuml
object myCar
@enduml

オブジェクトのクラス

:の後に続けて記載する事でオブジェクトのクラスを指定できます。

object "myCar: Car"
PlantUML図
PlantUMLソース
@startuml
object "myCar: Car"
@enduml

オブジェクトの別名

asの後に続けて記載する事でオブジェクトの別名を指定できます。
別目は、後でオブジェクトの関係などを定義する際などに使用できます。
見た目上の変化はありません。

object "myCar" as car

オブジェクトのメンバ

オブジェクトのメンバを定義できます。

car : brand = "Toyota"
PlantUML図
PlantUMLソース
@startuml
object "myCar" as car
car : brand = "Toyota"
@enduml

関連線

関連線を定義できます。

car -- house
PlantUML図
PlantUMLソース
@startuml
object "myCar" as car
object "myHouse" as house
car -- house
@enduml

位置調整

上

object1 -u- objectUp
PlantUML図
PlantUMLソース
@startuml
object "object1"
object "objectUp"
object1 -u- objectUp
@enduml

下

object1 -d- objectDown
PlantUML図
PlantUMLソース
object "object1"
object "objectDown"
object1 -d- objectDown
@enduml

左

object1 -l- objectLeft
PlantUML図
PlantUMLソース
@startuml
object "object1"
object "objectLeft"
object1 -l- objectLeft
@enduml

右

object1 -r- objectRight
PlantUML図
PlantUMLソース
@startuml
object "object1"
object "objectRight"
object1 -r- objectRight
@enduml