Cheat Sheet速查表
跳转到主要内容

PlantUML 速查表

本文根据 Devhints / PlantUML 翻译。代码示例及版本范围沿用原文。

关于

PlantUML 是一种用于创建图表的标记语言。

格式

@startuml
Car : drive()
Dog : bark()
@enduml

# plantuml file.uml && open file.png

类

方法

Car : drive()

方法(备选)

class Car {
  String make
  year : Integer
  void drive()

  -private()
  #protected()
  ~package private()
  +public()

  {static} String id
  {abstract} void methods()
}

行数

class Car {
  These are separated by lines.
  The next line is a dotted line
  ..
  Next is a double-stroke
  ==
  Next is a plain line
  --
  Next is a strong line
  __
  You can make headers with it
  .. header ..
}

关联

Car <|-- SmallCar      # extension
Car *-- Engine         # composition
Cars o-- Car           # aggregation
Car <|.. SmallCar      # dotted line (use .. instead of --)
Car <|--* Car

-left->
-right->

关系

Driver - Car : drives >
Car -- Owner : < owns
Car *-- Wheel : has 4 >

说明

class Car {
}
note left: Something something

note top of Car : This is a car.

命名空间

namespace Client {
  class Driver {
  }
}

Car -- Client.Driver : owns >

活动

(*) --> "First Activity"
-->[You can put also labels] "Second Activity"
--> (*)