Multilingual Wiki Documentation

You are currently using syntax.
In an attempt to improve PlantUML documentation...
Please do not use this website for your own diagrams.
You can click here and use the online server here for your own documentation.

Wiki Toc    Recent changes    View page history    Add new chapter    Reorder page    Raw


Diagrammes d'objets

Object Diagram

Définition des objets

Les instances d'objets sont défnies avec le mot clé object.

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

WARNING
 This translation need to be updated. 
WARNING

Definition of objects

You define instances of objects using the object keyword.

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

Relations entre les objets

Les relations entre objets sont définies à l'aide des symboles suivants :

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

Il est possible de remplacer -- par .. pour avoir des pointillés.

Grâce à ces règles, on peut avoir les dessins suivants:

Il est possible d'ajouter une étiquette sur la relation, en utilisant : suivi par le texte de l'étiquette.

Pour les cardinalités, vous pouvez utiliser les doubles quotes "" sur chaque côté de la 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

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

Associations objects

@startuml
object o1
object o2
diamond dia
object o3

o1  --> dia
o2  --> dia
dia --> o3
@enduml

Ajout de champs

Pour déclarer un champ, vous pouvez utiliser le symbole : suivi par le nom du champs.

@startuml

object user

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

@enduml

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

@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

Caractéristiques communes avec les diagrammes de classes

Common features with class diagrams

Map table or associative array

You can define a map table or associative array, with map keyword and => separator.

@startuml
map CapitalCity {
 UK => London
 USA => Washington
 Germany => Berlin
}
@enduml

@startuml
map "Map **Contry => CapitalCity**" as CC {
 UK => London
 USA => Washington
 Germany => Berlin
}
@enduml

@startuml
map "map: Map<Integer, String>" as users {
 1 => Alice
 2 => Bob
 3 => Charlie
}
@enduml

And add link with object.

@startuml
object London

map CapitalCity {
 UK *-> London
 USA => Washington
 Germany => Berlin
}
@enduml

@startuml
object London
object Washington
object Berlin
object NewYork

map CapitalCity {
 UK *-> London
 USA *--> Washington
 Germany *---> Berlin
}

NewYork --> CapitalCity::USA
@enduml

[Ref. #307]


Please report any bugs to plantuml@gmail.com or here.
This website is still in beta testing.