Deutsch      Español      Français      日本語      한국어      Русский      中文

Translation support

You can click here to access the wiki and update the translation.

You can go back to the translated webpage.

To help you in the translation process, here is a comparison with the English version :

对象图语法和特性

PlantUML对象图语法:您可以定义的对象,领域,关系,包,笔记...改变字体和颜色也有可能。

Object Diagram syntax and features

PlantUML object diagram syntax: You can define objects, fields, relationships, packages, notes... Changing fonts and colors is also possible.

 

对象图

 

Object Diagram

 

对象的定义

使用关键字object定义实例。

@startuml
object firstObject
object "My Second Object" as o2
@enduml

 

Definition of objects

You define instance of objects using the object keywords.

@startuml
object firstObject
object "My Second Object" as o2
@enduml

 

对象之间的关系

对象之间的关系用如下符号定义:

Type Symbol Image
Extension <|--
Composition *--
Aggregation o--

也可以用 .. 来代替 -- 以使用点线。

知道了这些规则,就可以画下面的图:

可以用冒号给关系添加标签,标签内容紧跟在冒号之后。

用双引号在关系的两边添加基数。

@startuml
object Object01
object Object02
object Object03
object Object04
object Object05
object Object06
object Object07
object Object08

Object01 <|-- Object02
Object03 *-- Object04
Object05 o-- "4" Object06
Object07 .. Object08 : some labels
@enduml

 

Relations between objects

Relations between objects are defined using the following symbols :

Type Symbol Image
Extension <|--
Composition *--
Aggregation o--

It is possible to replace -- by .. to have a dotted line.

Knowing those rules, it is possible to draw the following drawings.

It is possible a add a label on the relation, using : followed by the text of the label.

For cardinality, you can use double-quotes "" on each side of the relation.

@startuml
object Object01
object Object02
object Object03
object Object04
object Object05
object Object06
object Object07
object Object08

Object01 <|-- Object02
Object03 *-- Object04
Object05 o-- "4" Object06
Object07 .. Object08 : some labels
@enduml

 

添加属性

用冒号加属性名的形式声明属性。

@startuml

object user

user : name = "Dummy"
user : id = 123

@enduml

也可以用大括号批量声明属性。

@startuml

object user {
  name = "Dummy"
  id = 123
}

@enduml

 

Adding fields

To declare fields, you can use the symbol : followed by the field's name.

@startuml

object user

user : name = "Dummy"
user : id = 123

@enduml

It is also possible to group all fields between brackets {}.

@startuml

object user {
  name = "Dummy"
  id = 123
}

@enduml

 

类图中的通用特性

 

Common features with class diagrams

This page is generated once per day from the wiki content.

Quantcast