128
Desenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33) PlantUML é um projeto Open Source que permite escrever rapidamente: • Diagrama de sequência, • Diagrama de casos de uso, • Diagrama de classes, • Diagrama de atividades, • Diagrama de componentes, • Diagrama de estado, • Diagrama de objetos. Diagramas são definidos usando uma linguagem simples e intuitiva.

Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

Embed Size (px)

Citation preview

Page 1: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

Desenhando UML com PlantUML

Guia de Referência da Linguagem(Domingo, 12 de Novembro de 2017 16:33)

PlantUML é um projeto Open Source que permite escrever rapidamente:

• Diagrama de sequência,

• Diagrama de casos de uso,

• Diagrama de classes,

• Diagrama de atividades,

• Diagrama de componentes,

• Diagrama de estado,

• Diagrama de objetos.

Diagramas são definidos usando uma linguagem simples e intuitiva.

Page 2: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1 DIAGRAMA DE SEQUÊNCIA

1 Diagrama de Sequência1.1 Exemplos básicosA sequência -> é utilizada para desenhar uma mensagem entre dois participantes. Os participantes nãotêm de ser explicitamente declarados.

Para obter uma seta com pontos, utilize -->Também é possível utilizar <- e <--. Esta utilização não altera o desenho, mas pode melhorar a

leitura. Note que isto é verdade apenas para diagramas de sequência, as regras são diferentes para outrosdiagramas.@startumlAlice -> Bob: Authentication RequestBob --> Alice: Authentication Response

Alice -> Bob: Another authentication RequestAlice <-- Bob: another authentication Response@enduml

1.2 Declarando participanteÉ possível trocar a ordem do participante usando a palavra chave participant.

Também é possível utilizar outras palavras-chaves para declarar um participante:

• actor

• boundary

• control

• entity

• database

@startumlactor Foo1boundary Foo2control Foo3entity Foo4database Foo5collections Foo6Foo1 -> Foo2 : To boundaryFoo1 -> Foo3 : To controlFoo1 -> Foo4 : To entityFoo1 -> Foo5 : To databaseFoo1 -> Foo6 : To collections

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 1 of 127

Page 3: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.3 Utilizando caracteres não letras em participantes 1 DIAGRAMA DE SEQUÊNCIA

Você pode renomear um participante utilizando a palavra-chave as.Você também pode trocar a cor de fundo de um ator ou participante.

@startumlactor Bob #red' The only difference between actor'and participant is the drawingparticipant Aliceparticipant "I have a really\nlong name" as L #99FF99/' You can also declare:participant L as "I have a really\nlong name" #99FF99'/

Alice->Bob: Authentication RequestBob->Alice: Authentication ResponseBob->L: Log transaction@enduml

1.3 Utilizando caracteres não letras em participantesVocê pode utilizar aspas para definir participantes. E você também pode usar a palavra-chave as paradar um nome aos particiantes.@startumlAlice -> "Bob()" : Hello"Bob()" -> "This is very\nlong" as Long' You can also declare:' "Bob()" -> Long as "This is very\nlong"Long --> "Bob()" : ok@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 2 of 127

Page 4: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.4 Mensagem para você mesmo 1 DIAGRAMA DE SEQUÊNCIA

1.4 Mensagem para você mesmoUm participante pode enviar uma mensagem para ele mesmo.

Também é possível ter utilização de multilinhas utilizando \n.@startumlAlice->Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext@enduml

1.5 Modificando o estilo da setaVocê pode modificar o estilo das setas de diversas formas:

• Adicione um x ao final para denotar uma mensagem perdida

• Utilize \ ou / ao invés de < ou > para ter somente a parte do fundo ou a ponta da seta

• Repita a cabeça da seta (por exemplo, >> ou //) para ter um desenho fino da ponta da seta

• Utilize -- ao invés de - para ter uma seta pontilhada

• adicione um ”o” no final para ter uma ponta de flecha como seta

• Utilize seta bidirecional

@startumlBob ->x AliceBob -> AliceBob ->> AliceBob -\ AliceBob \\- AliceBob //-- Alice

Bob ->o AliceBob o\\-- Alice

Bob <-> AliceBob <->o Alice@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 3 of 127

Page 5: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.6 Modificando a cor da seta 1 DIAGRAMA DE SEQUÊNCIA

1.6 Modificando a cor da setaVocê pode mudar a cor de setas individuais com a seguinte notação:@startumlBob -[#red]> Alice : helloAlice -[#0000FF]->Bob : ok@enduml

1.7 Numeração de sequenncia de mensagensA palavra chave autonumber é utilizada para adicionar automaticamente numeração as mensagens.@startumlautonumberBob -> Alice : Authentication RequestBob <- Alice : Authentication Response@enduml

Você pode especificar um número de inicio com o autonumber 'start', e também um valor deincremento com o autonumber 'start' 'increment'.@startumlautonumberBob -> Alice : Authentication RequestBob <- Alice : Authentication Response

autonumber 15Bob -> Alice : Another authentication RequestBob <- Alice : Another authentication Response

autonumber 40 10Bob -> Alice : Yet another authentication Request

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 4 of 127

Page 6: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.7 Numeração de sequenncia de mensagens 1 DIAGRAMA DE SEQUÊNCIA

Bob <- Alice : Yet another authentication Response

@enduml

Você pode especificar uma formatação para seu número utilizado ele entre aspas simples.A formatação é realizada com a classe Java DecimalFormat (’0’ significa digito, ’#’ significa digito e

zero se ausente).Você também pode utilizar algumas tags de formatação em html.

@startumlautonumber "<b>[000]"Bob -> Alice : Authentication RequestBob <- Alice : Authentication Response

autonumber 15 "<b>(<u>##</u>)"Bob -> Alice : Another authentication RequestBob <- Alice : Another authentication Response

autonumber 40 10 "<font color=red><b>Message 0 "Bob -> Alice : Yet another authentication RequestBob <- Alice : Yet another authentication Response

@enduml

É possível utilizar autonumber stop e autonumber resume 'increment' 'format' para, respecti-vamente, pausar, continuar a numeração automática.@startumlautonumber 10 10 "<b>[000]"Bob -> Alice : Authentication RequestBob <- Alice : Authentication Response

autonumber stopBob -> Alice : dummy

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 5 of 127

Page 7: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.8 Dividindo diagramas 1 DIAGRAMA DE SEQUÊNCIA

autonumber resume "<font color=red><b>Message 0 "Bob -> Alice : Yet another authentication RequestBob <- Alice : Yet another authentication Response

autonumber stopBob -> Alice : dummy

autonumber resume 1 "<font color=blue><b>Message 0 "Bob -> Alice : Yet another authentication RequestBob <- Alice : Yet another authentication Response@enduml

1.8 Dividindo diagramasA palavra-chave newpage é utilizada para dividir um diagrama em diversas imagens.

Você pode colocar um título para a página logo após a palavra-chave newpage.é muito útil usar Word para imprimir um longo diagrama em diversas páginas.

@startuml

Alice -> Bob : message 1Alice -> Bob : message 2

newpage

Alice -> Bob : message 3Alice -> Bob : message 4

newpage A title for the\nlast page

Alice -> Bob : message 5Alice -> Bob : message 6@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 6 of 127

Page 8: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.9 Agrupando mensagens 1 DIAGRAMA DE SEQUÊNCIA

1.9 Agrupando mensagensÉ possível agrupar mensagens utilizando as seguintes palavras-chaves:

• alt/else

• opt

• loop

• par

• break

• critical

• group, seguidas de um texto para ser exibido

É possível inserir um texto que será exibido no cabeçalho (exceto para group).A palavra-chave end é utilizada para fechar o grupo.Observe que é possível aninhar grupos.

@startumlAlice -> Bob: Authentication Request

alt successful case

Bob -> Alice: Authentication Accepted

else some kind of failure

Bob -> Alice: Authentication Failuregroup My own labelAlice -> Log : Log attack startloop 1000 timesAlice -> Bob: DNS AttackendAlice -> Log : Log attack endend

else Another type of failure

Bob -> Alice: Please repeat

end@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 7 of 127

Page 9: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.10 Notas em mensagens 1 DIAGRAMA DE SEQUÊNCIA

1.10 Notas em mensagensVocê pode colocar notas em mensagens utilizando a palavra-chave note left ou note right, logo apósas mensagens.

Você pode ter uma notação multilinhas utilizando a palavra-chave end note.@startumlAlice->Bob : hellonote left: this is a first note

Bob->Alice : oknote right: this is another note

Bob->Bob : I am thinkingnote lefta notecan also be definedon several linesend note@enduml

1.11 Algumas outras notasTambém é possível definir notas relativas aos particiapantes com as palavras-chave note left of , noteright of ou note over.

Você pode destacar uma nota simplesmente modificando a cor de fundo dela.

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 8 of 127

Page 10: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.12 Modificando as formas das notas 1 DIAGRAMA DE SEQUÊNCIA

Você também pode ter comentários multilinha usando a palavra-chave end note.@startumlparticipant Aliceparticipant Bobnote left of Alice #aquaThis is displayedleft of Alice.end note

note right of Alice: This is displayed right of Alice.

note over Alice: This is displayed over Alice.

note over Alice, Bob #FFAAAA: This is displayed\n over Bob and Alice.

note over Bob, AliceThis is yet anotherexample ofa long note.end note@enduml

1.12 Modificando as formas das notasVocê pode utilizar as palavras chaves hnote e rnote para modificar a forma das notas.@startumlcaller -> server : conReqhnote over caller : idlecaller <- server : conConfrnote over server"r" as rectangle"h" as hexagonendrnote@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 9 of 127

Page 11: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.13 Formatação Nativa e HTML 1 DIAGRAMA DE SEQUÊNCIA

1.13 Formatação Nativa e HTMLTambém é possível utilizar formatação nativa:@startumlparticipant Aliceparticipant "The **Famous** Bob" as Bob

Alice -> Bob : hello --there--... Some ~~long delay~~ ...Bob -> Alice : oknote leftThis is **bold**This is //italics//This is ""monospaced""This is --stroked--This is __underlined__This is ~~waved~~end note

Alice -> Bob : A //well formatted// messagenote right of AliceThis is <back:cadetblue><size:18>displayed</size></back>__left of__ Alice.end notenote left of Bob<u:red>This</u> is <color #118888>displayed</color>**<color purple>left of</color> <s:red>Alice</strike> Bob**.end notenote over Alice, Bob<w:#FF33FF>This is hosted</w> by <img sourceforge.jpg>end note@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 10 of 127

Page 12: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.14 Divisor 1 DIAGRAMA DE SEQUÊNCIA

1.14 DivisorSe for de seu desejo, você pode dividir um diagrama utilizando o separador == para dividir seu diagramade passos lógicos.@startuml

== Initialization ==

Alice -> Bob: Authentication RequestBob --> Alice: Authentication Response

== Repetition ==

Alice -> Bob: Another authentication RequestAlice <-- Bob: another authentication Response

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 11 of 127

Page 13: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.15 Referência 1 DIAGRAMA DE SEQUÊNCIA

1.15 ReferênciaVocê pode usar referências em um diagrama usando a palavra chave ref over.@startumlparticipant Aliceactor Bob

ref over Alice, Bob : init

Alice -> Bob : hello

ref over BobThis can be onseveral linesend ref@enduml

1.16 AtrasoÉ possível utilizar ... para indicar o atraso no diagrama. e também é possível por uma mensagem comesse atraso.@startuml

Alice -> Bob: Authentication Request...Bob --> Alice: Authentication Response...5 minutes latter...Bob --> Alice: Bye !

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 12 of 127

Page 14: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.17 Espaço 1 DIAGRAMA DE SEQUÊNCIA

1.17 EspaçoVocê pode utilizar ||| para indicar espaçamento no diagrama.

Pode-se espeficicar o número de pixels a ser utilizado.@startuml

Alice -> Bob: message 1Bob --> Alice: ok|||Alice -> Bob: message 2Bob --> Alice: ok||45||Alice -> Bob: message 3Bob --> Alice: ok

@enduml

1.18 Lifeline Ativação e DestruiçãoAs palavras-chave activate e deactivate são utilizadas para denotar ativação de participantes.

Uma vez que um participante é ativado, sua lifeline aparece.As palavras activate e deactivate são aplicadas na mensagem anterior.O texto destroy denota o fim de vida da lifeline de um participante.

@startumlparticipant User

User -> A: DoWorkactivate A

A -> B: << createRequest >>activate B

B -> C: DoWorkactivate CC --> B: WorkDonedestroy C

B --> A: RequestCreateddeactivate B

A -> User: Donedeactivate A

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 13 of 127

Page 15: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.19 Criação de participante 1 DIAGRAMA DE SEQUÊNCIA

Lifeline aninhada pode ser utilizada, e é possível adicionar uma cor na lifeline.@startumlparticipant User

User -> A: DoWorkactivate A #FFBBBB

A -> A: Internal callactivate A #DarkSalmon

A -> B: << createRequest >>activate B

B --> A: RequestCreateddeactivate Bdeactivate AA -> User: Donedeactivate A

@enduml

1.19 Criação de participanteVocê pode utilizar a palavra chave create logo antes da primeira recepção de uma mensagem paraenfatizar que esta mensagem creating está na realidade criando este novo objeto.@startumlBob -> Alice : hello

create OtherAlice -> Other : new

create control StringAlice -> Stringnote right : You can also put notes!

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 14 of 127

Page 16: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.20 Mensagens de entrada e saída 1 DIAGRAMA DE SEQUÊNCIA

Alice --> Bob : ok

@enduml

1.20 Mensagens de entrada e saídaVocê pode utilizar setas de entrada ou saída para focar em uma parte do diagrama.

Utilize os colchetes quadrados para denotar o lado esquerdo ”[” ou o lado direito ”]” do diagrama.@startuml[-> A: DoWork

activate A

A -> A: Internal callactivate A

A ->] : << createRequest >>

A<--] : RequestCreateddeactivate A[<- A: Donedeactivate A@enduml

Você também pode ter a seguinte sintaxe:@startuml[-> Bob[o-> Bob[o->o Bob[x-> Bob

[<- Bob[x<- Bob

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 15 of 127

Page 17: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.21 Esteriótipos e pontos 1 DIAGRAMA DE SEQUÊNCIA

Bob ->]Bob ->o]Bob o->o]Bob ->x]

Bob <-]Bob x<-]@enduml

1.21 Esteriótipos e pontosÉ possível adicionar esteriótipos para participar utilizando e texto << e >>.

No esteriótipo, você pode utilizar um caractere em formato de ponto em um circulo colorido utlizandoa sintaxe (X,color).@startuml

participant "Famous Bob" as Bob << Generated >>participant Alice << (C,#ADD1B2) Testable >>

Bob->Alice: First message

@enduml

Por padrão, o caractereguillemet é usado para exibir o estereótipo. Você pode alterar esse comporta-mento usando o skinparam guillemet:@startuml

skinparam guillemet falseparticipant "Famous Bob" as Bob << Generated >>participant Alice << (C,#ADD1B2) Testable >>

Bob->Alice: First message

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 16 of 127

Page 18: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.22 Mais informações em títulos 1 DIAGRAMA DE SEQUÊNCIA

@startuml

participant Bob << (C,#ADD1B2) >>participant Alice << (C,#ADD1B2) >>

Bob->Alice: First message

@enduml

1.22 Mais informações em títulosVocê pode utilizar formatação nativa no título.@startuml

title __Simple__ **communication** example

Alice -> Bob: Authentication RequestBob -> Alice: Authentication Response

@enduml

Você pode inserir nova linha utilizando \n na descrição do título.@startuml

title __Simple__ communication example\non several lines

Alice -> Bob: Authentication RequestBob -> Alice: Authentication Response

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 17 of 127

Page 19: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.23 Abranger participantes 1 DIAGRAMA DE SEQUÊNCIA

Você também pode definir título em diversas linhas usando as palavras-chave title e end title.@startuml

title<u>Simple</u> communication exampleon <i>several</i> lines and using <font color=red>html</font>This is hosted by <img:sourceforge.jpg>end title

Alice -> Bob: Authentication RequestBob -> Alice: Authentication Response

@enduml

1.23 Abranger participantesPode-se desenhar uma caixa ao redor de alguns participantes utilizando os comandos box e end box.

Você pode adicionar um título opcional ou uma cor de fundo, após a palavra-chave box.@startuml

box "Internal Service" #LightBlueparticipant Bobparticipant Aliceend boxparticipant Other

Bob -> Alice : helloAlice -> Other : hello

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 18 of 127

Page 20: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.24 Removendo rodapé 1 DIAGRAMA DE SEQUÊNCIA

1.24 Removendo rodapéVocê pode utilizar a palavra-chave hide footbox para remover o rodapé do diagrama.@startuml

hide footboxtitle Footer removed

Alice -> Bob: Authentication RequestBob --> Alice: Authentication Response

@enduml

1.25 Parâmetros para desenhoÉ possível utilizar o comando skinparam para modificar as cores e fontes do desenho da imagem.

Você pode utilizar esse comando:

• Na definição de diagramas, como quaisquer outros comandos,

• em um arquivo incluído,

• Em um arquivo de configuração, fornecido via linha de comando ou via tarefa ANT.

Você também pode alterar outro parâmetro de renderização, como visto nos exemplos a seguir:@startumlskinparam sequenceArrowThickness 2skinparam roundcorner 20skinparam maxmessagesize 60skinparam sequenceParticipant underline

actor Userparticipant "First Class" as Aparticipant "Second Class" as Bparticipant "Last Class" as C

User -> A: DoWorkactivate A

A -> B: Create Requestactivate B

B -> C: DoWorkactivate CC --> B: WorkDone

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 19 of 127

Page 21: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.25 Parâmetros para desenho 1 DIAGRAMA DE SEQUÊNCIA

destroy C

B --> A: Request Createddeactivate B

A --> User: Donedeactivate A

@enduml

@startumlskinparam backgroundColor #EEEBDCskinparam handwritten true

skinparam sequence {ArrowColor DeepSkyBlueActorBorderColor DeepSkyBlueLifeLineBorderColor blueLifeLineBackgroundColor #A9DCDF

ParticipantBorderColor DeepSkyBlueParticipantBackgroundColor DodgerBlueParticipantFontName ImpactParticipantFontSize 17ParticipantFontColor #A9DCDF

ActorBackgroundColor aquaActorFontColor DeepSkyBlueActorFontSize 17ActorFontName Aapex}

actor Userparticipant "First Class" as Aparticipant "Second Class" as Bparticipant "Last Class" as C

User -> A: DoWorkactivate A

A -> B: Create Requestactivate B

B -> C: DoWorkactivate C

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 20 of 127

Page 22: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

1.26 Mudança de preenchimento 1 DIAGRAMA DE SEQUÊNCIA

C --> B: WorkDonedestroy C

B --> A: Request Createddeactivate B

A --> User: Donedeactivate A

@enduml

1.26 Mudança de preenchimentoÉ possível sintonizar algumas configurações de preenchimento.@startumlskinparam ParticipantPadding 20skinparam BoxPadding 10

box "Foo1"participant Alice1participant Alice2end boxbox "Foo2"participant Bob1participant Bob2end boxAlice1 -> Bob1 : helloAlice1 -> Out : out@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 21 of 127

Page 23: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2 DIAGRAMA DE CASO DE USO

2 Diagrama de Caso de Uso2.1 Casos de UsoCasos de uso são inseridos entre parenteses (porque dois parenteses são como uma elipse).

Você deve usar a palavra-chave usecase para definir um caso de uso. E você pode definir um apelidousando a palavra-chave as. Este apelido será utilizado mais adiante, quando definiremos as relações entrecomponentes do diagrama.@startuml

(First usecase)(Another usecase) as (UC2)usecase UC3usecase (Last\nusecase) as UC4

@enduml

2.2 AtoresAtores são delimitados por caracteres dois pontos.

Você pode utilizar a palavra chave actor para definir um ator. E você pode definir um apelido usandoa palavra chave as. O apelido será utilizado na definição dos relacionamentos.

Veremos posteriormente que as definições de atores são opcionais.@startuml

:First Actor::Another\nactor: as Men2actor Men3actor :Last actor: as Men4

@enduml

2.3 Descrição de casos de usoSe você necessita de uma descrição que utilize várias linhas basta utilizar aspas.

Você também pode utilizar os seguitnes separadores: -- .. == __. E você pode colocar títulos nosseparadores.

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 22 of 127

Page 24: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2.4 Exemplo básico 2 DIAGRAMA DE CASO DE USO

@startuml

usecase UC1 as "You can useseveral lines to define your usecase.You can also use separators.--Several separators are possible.==And you can add titles:..Conclusion..This allows large description."

@enduml

2.4 Exemplo básicoPara vincular atores e casos de uso, a seta/ --> é usado.

Quando mais traços "-", na seta, mais logo a seta Você pode adicionar um rótulo na seta, adicionandoum ” :” caractere na definição da seta.

Neste exemplo, você vê que textit Usuário não foi definido antes, e é usado como ator.@startuml

User -> (Start)User --> (Use the application) : A small label

:Main Admin: ---> (Use the application) : This is\nyet another\nlabel

@enduml

2.5 ExtensãoSe um ator/caso de uso extende outro, você pode usar o símbolo <|-- (que extende para ).

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 23 of 127

Page 25: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2.6 Usando notas 2 DIAGRAMA DE CASO DE USO

@startuml:Main Admin: as Admin(Use the application) as (Use)

User <|-- Admin(Start) <|-- (Use)

@enduml

2.6 Usando notasVocê pode usar nota à esquerda , nota à direita , nota no topo , nota na base palavras-chavepara definir notas relacionadas a um único objeto.

A note can be also define alone with the note keywords, then linked to other objects using the ..symbol.@startuml:Main Admin: as Admin(Use the application) as (Use)

User -> (Start)User --> (Use)

Admin ---> (Use)

note right of Admin : This is an example.

note right of (Use)A note can alsobe on several linesend note

note "This note is connected\nto several objects." as N2(Start) .. N2N2 .. (Use)@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 24 of 127

Page 26: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2.7 Estereótipos 2 DIAGRAMA DE CASO DE USO

2.7 EstereótiposVocê pode adidicionar estereótipos quando definir ator e casos de uso utilizando ” <<” and ” >> ”.@startumlUser << Human >>:Main Database: as MySql << Application >>(Start) << One Shot >>(Use the application) as (Use) << Main >>

User -> (Start)User --> (Use)

MySql --> (Use)

@enduml

2.8 Changing arrows directionBy default, links between classes have two dashes -- and are vertically oriented. It is possible to usehorizontal link by putting a single dash (or dot) like this:@startuml:user: --> (Use case 1):user: -> (Use case 2)@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 25 of 127

Page 27: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2.9 Splitting diagrams 2 DIAGRAMA DE CASO DE USO

You can also change directions by reversing the link:@startuml(Use case 1) <.. :user:(Use case 2) <- :user:@enduml

It is also possible to change arrow direction by adding left, right, up or down keywords inside thearrow:@startuml:user: -left-> (dummyLeft):user: -right-> (dummyRight):user: -up-> (dummyUp):user: -down-> (dummyDown)@enduml

You can shorten the arrow by using only the first character of the direction (for example, -d- insteadof -down-) or the two first characters (-do-).

Please note that you should not abuse this functionality : Graphviz gives usually good results withouttweaking.

2.9 Splitting diagramsThe newpage keywords to split your diagram into several pages or images.

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 26 of 127

Page 28: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2.10 Left to right direction 2 DIAGRAMA DE CASO DE USO

@startuml:actor1: --> (Usecase1)newpage:actor2: --> (Usecase2)@enduml

2.10 Left to right directionThe general default behavior when building diagram is top to bottom.@startuml'defaulttop to bottom directionuser1 --> (Usecase 1)user2 --> (Usecase 2)

@enduml

You may change to left to right using the left to right direction command. The result is oftenbetter with this direction.@startuml

left to right directionuser1 --> (Usecase 1)user2 --> (Usecase 2)

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 27 of 127

Page 29: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2.11 Skinparam 2 DIAGRAMA DE CASO DE USO

2.11 SkinparamVocê pode usar o comando skinparam para mudar core e fonte dos desenhos.

Você pode usar este comando:

• Na definição do diagrama, assim como outros comandos,

• Em um arquivo incluído,

• Em um arquivo de configuração, fornecido na linha de comando ou na ANT task.

Você pode definir cores e fontes específicas para atores e casos de usos instanciados.@startumlskinparam handwritten true

skinparam usecase {BackgroundColor DarkSeaGreenBorderColor DarkSlateGray

BackgroundColor<< Main >> YellowGreenBorderColor<< Main >> YellowGreen

ArrowColor OliveActorBorderColor blackActorFontName Courier

ActorBackgroundColor << Human >> Gold}

User << Human >>:Main Database: as MySql << Application >>(Start) << One Shot >>(Use the application) as (Use) << Main >>

User -> (Start)User --> (Use)

MySql --> (Use)

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 28 of 127

Page 30: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

2.12 Exemplo completo 2 DIAGRAMA DE CASO DE USO

2.12 Exemplo completo

@startumlleft to right directionskinparam packageStyle rectangleactor customeractor clerkrectangle checkout {customer -- (checkout)(checkout) .> (payment) : include(help) .> (checkout) : extends(checkout) -- clerk}@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 29 of 127

Page 31: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3 CLASS DIAGRAM

3 Class Diagram3.1 Relations between classesRelations between classes are defined using the following symbols :

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:

@startumlClass01 <|-- Class02Class03 *-- Class04Class05 o-- Class06Class07 .. Class08Class09 -- Class10@enduml

@startumlClass11 <|.. Class12Class13 --> Class14Class15 ..> Class16Class17 ..|> Class18Class19 <--* Class20@enduml

@startumlClass21 #-- Class22Class23 x-- Class24Class25 }-- Class26Class27 +-- Class28Class29 ^-- Class30@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 30 of 127

Page 32: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.2 Label on relations 3 CLASS DIAGRAM

3.2 Label on relationsIt 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

Class01 "1" *-- "many" Class02 : contains

Class03 o-- Class04 : aggregation

Class05 --> "1" Class06

@enduml

You can add an extra arrow pointing at one object showing which object acts on the other object,using < or > at the begin or at the end of the label.@startumlclass Car

Driver - Car : drives >Car *- Wheel : have 4 >Car -- Person : < owns

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 31 of 127

Page 33: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.3 Adding methods 3 CLASS DIAGRAM

3.3 Adding methodsTo declare fields and methods, you can use the symbol ":" followed by the field’s or method’s name.

The system checks for parenthesis to choose between methods and fields.

@startumlObject <|-- ArrayList

Object : equals()ArrayList : Object[] elementDataArrayList : size()

@enduml

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

Note that the syntax is highly flexible about type/name order.

@startumlclass Dummy {String datavoid methods()}

class Flight {flightNumber : IntegerdepartureTime : Date}@enduml

You can use {field} and {method} modifiers to override default behaviour of the parser about fieldsand methods.@startumlclass Dummy {{field} A field (despite parentheses){method} Some method}

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 32 of 127

Page 34: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.4 Defining visibility 3 CLASS DIAGRAM

3.4 Defining visibilityWhen you define methods or fields, you can use characters to define the visibility of the corresponding

item:

- private# protected̃ package private+ public

@startuml

class Dummy {-field1#field2~method1()+method2()}

@enduml

You can turn off this feature using the skinparam classAttributeIconSize 0 command :

@startumlskinparam classAttributeIconSize 0class Dummy {-field1#field2~method1()+method2()}

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 33 of 127

Page 35: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.5 Abstract and Static 3 CLASS DIAGRAM

3.5 Abstract and StaticYou can define static or abstract methods or fields using the {static} or {abstract} modifier.

These modifiers can be used at the start or at the end of the line. You can also use {classifier}instead of {static}.

@startumlclass Dummy {{static} String id{abstract} void methods()}@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 34 of 127

Page 36: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.6 Advanced class body 3 CLASS DIAGRAM

3.6 Advanced class bodyBy default, methods and fields are automatically regrouped by PlantUML. You can use separators to

define your own way of ordering fields and methods. The following separators are possible : -- ..== __.

You can also use titles within the separators:

@startumlclass Foo1 {You can useseveral lines..as you wantand group==things together.__You can have as many groupsas you want--End of class}

class User {.. Simple Getter ..+ getName()+ getAddress().. Some setter ..+ setName()__ private data __int age-- encrypted --String password}

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 35 of 127

Page 37: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.7 Notes and stereotypes 3 CLASS DIAGRAM

3.7 Notes and stereotypesStereotypes are defined with the class keyword, ” << ” and ” >> ”.

You can also define notes using note left of , note right of , note top of , note bottom ofkeywords.

You can also define a note on the last defined class using note left, note right, note top, notebottom.

A note can be also define alone with the note keywords, then linked to other objects using the ..symbol.@startumlclass Object << general >>Object <|--- ArrayList

note top of Object : In java, every class\nextends this one.

note "This is a floating note" as N1note "This note is connected\nto several objects." as N2Object .. N2N2 .. ArrayList

class Foonote left: On last defined class

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 36 of 127

Page 38: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.8 More on notes 3 CLASS DIAGRAM

3.8 More on notes

It is also possible to use few html tags like :

• <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

You can also have a note on several lines.You can also define a note on the last defined class using note left, note right, note top, notebottom.@startuml

class Foonote left: On last defined class

note top of ObjectIn java, <size:18>every</size> <u>class</u><b>extends</b><i>this</i> one.end note

note as N1This note is <u>also</u><b><color:royalBlue>on several</color><s>words</s> linesAnd this is hosted by <img:sourceforge.jpg>end note

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 37 of 127

Page 39: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.9 Note on links 3 CLASS DIAGRAM

3.9 Note on links

It is possible to add a note on a link, just after the link definition, using note on link.You can also use note left on link, note right on link, note top on link, note bottom onlink if you want to change the relative position of the note with the label.@startuml

class DummyDummy --> Foo : A linknote on link #red: note that is red

Dummy --> Foo2 : Another linknote right on link #bluethis is my note on right linkand in blueend note

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 38 of 127

Page 40: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.10 Abstract class and interface 3 CLASS DIAGRAM

3.10 Abstract class and interface

You can declare a class as abstract using "abstract" or "abstract class" keywords.The class will be printed in italic.You can use the interface, annotation and enum keywords too.@startuml

abstract class AbstractListabstract AbstractCollectioninterface Listinterface Collection

List <|-- AbstractListCollection <|-- AbstractCollection

Collection <|- ListAbstractCollection <|- AbstractListAbstractList <|-- ArrayList

class ArrayList {Object[] elementDatasize()}

enum TimeUnit {DAYSHOURSMINUTES}

annotation SuppressWarnings

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 39 of 127

Page 41: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.11 Using non-letters 3 CLASS DIAGRAM

3.11 Using non-letters

If you want to use non-letters in the class (or enum...) display, you can either :

• Use the as keyword in the class definition• Put quotes "" around the class name

@startumlclass "This is my class" as class1class class2 as "It works this way too"

class2 *-- "foo/dummy" : use@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 40 of 127

Page 42: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.12 Hide attributes, methods... 3 CLASS DIAGRAM

3.12 Hide attributes, methods...

You can parameterize the display of classes using the hide/show command.The basic command is: hide empty members. This command will hide attributes or methods ifthey are empty.Instead of empty members, you can use:

• empty fields or empty attributes for empty fields,• empty methods for empty methods,• fields or attributes which will hide fields, even if they are described,• methods which will hide methods, even if they are described,• members which will hide fields and methods, even if they are described,• circle for the circled character in front of class name,• stereotype for the stereotype.

You can also provide, just after the hide or show keyword:

• class for all classes,• interface for all interfaces,• enum for all enums,• <<foo1>> for classes which are stereotyped with foo1,• an existing class name.

You can use several show/hide commands to define rules and exceptions.@startuml

class Dummy1 {+myMethods()}

class Dummy2 {+hiddenMethod()}

class Dummy3 <<Serializable>> {String name}

hide membershide <<Serializable>> circleshow Dummy1 methodsshow <<Serializable>> fields

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 41 of 127

Page 43: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.13 Hide classes 3 CLASS DIAGRAM

3.13 Hide classes

You can also use the show/hide commands to hide classes.This may be useful if you define a large !included file, and if you want to hide come classes afterfile inclusion.@startuml

class Foo1class Foo2

Foo2 *-- Foo1

hide Foo2

@enduml

3.14 Use generics

You can also use bracket < and > to define generics usage in a class.@startuml

class Foo<? extends Element> {int size()}Foo *- Element

@enduml

It is possible to disable this drawing using skinparam genericDisplay old command.

3.15 Specific Spot

Usually, a spotted character (C, I, E or A) is used for classes, interface, enum and abstract classes.But you can define your own spot for a class when you define the stereotype, adding a singlecharacter and a color, like in this example:@startuml

class System << (S,#FF7700) Singleton >>class Date << (D,orchid) >>@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 42 of 127

Page 44: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.16 Packages 3 CLASS DIAGRAM

3.16 Packages

You can define a package using the package keyword, and optionally declare a background colorfor your package (Using a html color code or name).Note that package definitions can be nested.@startuml

package "Classic Collections" #DDDDDD {Object <|-- ArrayList}

package net.sourceforge.plantuml {Object <|-- Demo1Demo1 *- Demo2}

@enduml

3.17 Packages style

There are different styles available for packages.You can specify them either by setting a default style with the command : skinparam packageStyle,or by using a stereotype on the package:@startumlscale 750 widthpackage 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

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 43 of 127

Page 45: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.18 Namespaces 3 CLASS DIAGRAM

You can also define links between packages, like in the following example:@startuml

skinparam packageStyle rectangle

package foo1.foo2 {}

package foo1.foo2.foo3 {class Object}

foo1.foo2 +-- foo1.foo2.foo3

@enduml

3.18 Namespaces

In packages, the name of a class is the unique identifier of this class. It means that you cannot havetwo classes with the very same name in different packages.In that case, you should use namespaces instead of packages.You can refer to classes from other namespaces by fully qualify them. Classes from the defaultnamespace are qualified with a starting dot.Note that you don’t have to explicitly create namespace : a fully qualified class is automaticallyput in the right namespace.@startuml

class BaseClass

namespace net.dummy #DDDDDD {.BaseClass <|-- PersonMeeting o-- Person

.BaseClass <|- Meeting}

namespace net.foo {net.dummy.Person <|- Person.BaseClass <|-- Person

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 44 of 127

Page 46: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.19 Automatic namespace creation 3 CLASS DIAGRAM

net.dummy.Meeting o-- Person}

BaseClass <|-- net.unused.Person

@enduml

3.19 Automatic namespace creation

You can define another separator (other than the dot) using the command : set namespaceSeparator???.@startuml

set namespaceSeparator ::class X1::X2::foo {some info}

@enduml

You can disable automatic package creation using the command set namespaceSeparator none.@startuml

set namespaceSeparator noneclass X1.X2.foo {some info}

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 45 of 127

Page 47: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.20 Lollipop interface 3 CLASS DIAGRAM

3.20 Lollipop interface

You can also define lollipops interface on classes, using the following syntax:

• bar ()- foo• bar ()-- foo• foo -() bar

@startumlclass foobar ()- foo@enduml

3.21 Changing arrows direction

By default, links between classes have two dashes -- and are vertically oriented. It is possible touse horizontal link by putting a single dash (or dot) like this:@startumlRoom o- StudentRoom *-- Chair@enduml

You can also change directions by reversing the link:@startumlStudent -o RoomChair --* Room@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 46 of 127

Page 48: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.22 Association classes 3 CLASS DIAGRAM

It is also possible to change arrow direction by adding left, right, up or down keywords inside thearrow:@startumlfoo -left-> dummyLeftfoo -right-> dummyRightfoo -up-> dummyUpfoo -down-> dummyDown@enduml

You can shorten the arrow by using only the first character of the direction (for example, -d-instead of -down-) or the two first characters (-do-).Please note that you should not abuse this functionality : Graphviz gives usually good resultswithout tweaking.

3.22 Association classes

You can define association class after that a relation has been defined between two classes, like inthis example:@startumlclass Student {Name}Student "0..*" - "1..*" Course(Student, Course) .. Enrollment

class Enrollment {drop()cancel()}@enduml

You can define it in another direction:

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 47 of 127

Page 49: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.23 Skinparam 3 CLASS DIAGRAM

@startumlclass Student {Name}Student "0..*" -- "1..*" Course(Student, Course) . Enrollment

class Enrollment {drop()cancel()}@enduml

3.23 Skinparam

You can use the skinparam command to change colors and fonts for the drawing.You can use this command :

• In the diagram definition, like any other commands,• In an included file,• In a configuration file, provided in the command line or the ANT task.

@startuml

skinparam class {BackgroundColor PaleGreenArrowColor SeaGreenBorderColor SpringGreen}skinparam stereotypeCBackgroundColor YellowGreen

Class01 "1" *-- "many" Class02 : contains

Class03 o-- Class04 : aggregation

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 48 of 127

Page 50: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.24 Skinned Stereotypes 3 CLASS DIAGRAM

3.24 Skinned Stereotypes

You can define specific color and fonts for stereotyped classes.@startuml

skinparam class {BackgroundColor PaleGreenArrowColor SeaGreenBorderColor SpringGreenBackgroundColor<<Foo>> WheatBorderColor<<Foo>> Tomato}skinparam stereotypeCBackgroundColor YellowGreenskinparam stereotypeCBackgroundColor << Foo >> DimGray

Class01 <<Foo>>Class03 <<Foo>>Class01 "1" *-- "many" Class02 : contains

Class03 o-- Class04 : aggregation

@enduml

3.25 Color gradient

It’s possible to declare individual color for classes or note using the notation.You can use either standard color name or RGB code.You can also use color gradient in background, with the following syntax: two colors names separatedeither by:

• |,• /,• \,• or -

depending the direction of the gradient.For example, you could have:

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 49 of 127

Page 51: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.26 Help on layout 3 CLASS DIAGRAM

@startuml

skinparam backgroundcolor AntiqueWhite/Goldskinparam classBackgroundColor Wheat|CornflowerBlue

class Foo #red-greennote left of Foo #blue\9932CCthis is mynote on this classend note

package example #GreenYellow/LightGoldenRodYellow {class Dummy}

@enduml

3.26 Help on layout

Sometimes, the default layout is not perfect...You can use together keyword to group some classes together : the layout engine will try to groupthem (as if they were in the same package).You can also use hidden links to force the layout.@startuml

class Bar1class Bar2together {class Together1class Together2class Together3}Together1 - Together2Together2 - Together3Together2 -[hidden]--> Bar1Bar1 -[hidden]> Bar2

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 50 of 127

Page 52: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.27 Splitting large files 3 CLASS DIAGRAM

3.27 Splitting large files

Sometimes, you will get some very large image files.You can use the ”page (hpages)x(vpages)” command to split the generated image into severalfiles :hpages is a number that indicated the number of horizontal pages, and vpages is a number thatindicated the number of vertical pages.You can also use some specific skinparam settings to put borders on splitted pages (see example).@startuml' Split into 4 pagespage 2x2skinparam pageMargin 10skinparam pageExternalColor grayskinparam pageBorderColor black

class BaseClass

namespace net.dummy #DDDDDD {.BaseClass <|-- PersonMeeting o-- Person

.BaseClass <|- Meeting

}

namespace net.foo {net.dummy.Person <|- Person.BaseClass <|-- Person

net.dummy.Meeting o-- Person}

BaseClass <|-- net.unused.Person@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 51 of 127

Page 53: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

3.27 Splitting large files 3 CLASS DIAGRAM

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 52 of 127

Page 54: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4 ACTIVITY DIAGRAM

4 Activity Diagram

4.1 Simple Activity

You can use (*) for the starting point and ending point of the activity diagram.In some occasion, you may want to use (*top) to force the starting point to be at the top of thediagram.Use --> for arrows.@startuml

(*) --> "First Activity""First Activity" --> (*)

@enduml

4.2 Label on arrows

By default, an arrow starts at the last used activity.You can put a label on an arrow using brackets [ and ] just after the arrow definition.@startuml

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

@enduml

4.3 Changing arrow direction

You can use -> for horizontal arrows. It is possible to force arrow’s direction using the followingsyntax:

• -down-> (default arrow)

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 53 of 127

Page 55: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.4 Branches 4 ACTIVITY DIAGRAM

• -right-> or ->• -left->• -up->

@startuml

(*) -up-> "First Activity"-right-> "Second Activity"--> "Third Activity"-left-> (*)

@enduml

4.4 Branches

You can use if/then/else keywords to define branches.@startuml(*) --> "Initialization"

if "Some Test" then-->[true] "Some Activity"--> "Another activity"-right-> (*)else->[false] "Something else"-->[Ending process] (*)endif

@enduml

Unfortunately, you will have to sometimes repeat the same activity in the diagram text:

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 54 of 127

Page 56: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.5 More on Branches 4 ACTIVITY DIAGRAM

@startuml(*) --> "check input"If "input is verbose" then--> [Yes] "turn on verbosity"--> "run command"else--> "run command"Endif-->(*)@enduml

4.5 More on Branches

By default, a branch is connected to the last defined activity, but it is possible to override this andto define a link with the if keywords.It is also possible to nest branches.@startuml

(*) --> if "Some Test" then

-->[true] "activity 1"

if "" then-> "activity 3" as a3elseif "Other test" then-left-> "activity 5"else--> "activity 6"endifendif

else

->[false] "activity 2"

endif

a3 --> if "last test" then--> "activity 7"else-> "activity 8"

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 55 of 127

Page 57: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.6 Synchronization 4 ACTIVITY DIAGRAM

endif

@enduml

4.6 Synchronization

You can use === code === to display synchronization bars.@startuml

(*) --> ===B1===--> "Parallel Activity 1"--> ===B2===

===B1=== --> "Parallel Activity 2"--> ===B2===

--> (*)

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 56 of 127

Page 58: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.7 Long activity description 4 ACTIVITY DIAGRAM

4.7 Long activity description

When you declare activities, you can span on several lines the description text. You can also add\n in the description.You can also give a short code to the activity with the as keyword. This code can be used latterin the diagram description.@startuml(*) -left-> "this <size:20>activity</size>is <b>very</b> <color:red>long2</color>and defined on several linesthat contains many <i>text</i>" as A1

-up-> "Another activity\n on several lines"

A1 --> "Short activity <img:sourceforge.jpg>"@enduml

4.8 Notes

You can add notes on a activity using the commands note left, note right, note top or notebottom, just after the description of the activity you want to note.If you want to put a note on the starting point, define the note at the very beginning of the diagramdescription.You can also have a note on several lines, using the endnote keywords.@startuml

(*) --> "Some Activity"note right: This activity has to be defined"Some Activity" --> (*)note leftThis note is onseveral linesend note

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 57 of 127

Page 59: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.9 Partition 4 ACTIVITY DIAGRAM

4.9 Partition

You can define a partition using the partition keyword, and optionally declare a background colorfor your partition (Using a html color code or name)When you declare activities, they are automatically put in the last used partition.You can close the partition definition using a closing bracket }.@startuml

partition Conductor {(*) --> "Climbs on Platform"--> === S1 ===--> Bows}

partition Audience #LightSkyBlue {=== S1 === --> Applauds}

partition Conductor {Bows --> === S2 ===--> WavesArmesApplauds --> === S2 ===}

partition Orchestra #CCCCEE {WavesArmes --> Introduction--> "Play music"}

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 58 of 127

Page 60: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.10 Skinparam 4 ACTIVITY DIAGRAM

4.10 Skinparam

You can use the skinparam command to change colors and fonts for the drawing.You can use this command :

• In the diagram definition, like any other commands,• In an included file,• In a configuration file, provided in the command line or the ANT task.

You can define specific color and fonts for stereotyped activities.@startuml

skinparam backgroundColor #AAFFFFskinparam activity {StartColor redBarColor SaddleBrownEndColor SilverBackgroundColor PeruBackgroundColor<< Begin >> OliveBorderColor PeruFontName Impact}

(*) --> "Climbs on Platform" << Begin >>--> === S1 ===--> Bows--> === S2 ===--> WavesArmes--> (*)

@enduml

4.11 Octagon

You can change the shape of activities to octagon using the skinparam activityShape octagoncommand.@startuml'Default is skinparam activityShape roundBoxskinparam activityShape octagon

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 59 of 127

Page 61: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.12 Complete example 4 ACTIVITY DIAGRAM

(*) --> "First Activity""First Activity" --> (*)

@enduml

4.12 Complete example

@startumltitle Servlet Container

(*) --> "ClickServlet.handleRequest()"--> "new Page"

if "Page.onSecurityCheck" then->[true] "Page.onInit()"

if "isForward?" then->[no] "Process controls"

if "continue processing?" then-->[yes] ===RENDERING===else-->[no] ===REDIRECT_CHECK===endif

else-->[yes] ===RENDERING===endif

if "is Post?" then-->[yes] "Page.onPost()"--> "Page.onRender()" as render--> ===REDIRECT_CHECK===else-->[no] "Page.onGet()"--> renderendif

else-->[false] ===REDIRECT_CHECK===endif

if "Do redirect?" then->[yes] "redirect request"--> ==BEFORE_DESTROY===elseif "Do Forward?" then-left->[yes] "Forward request"--> ==BEFORE_DESTROY===else-right->[no] "Render page template"--> ==BEFORE_DESTROY===endifendif

--> "Page.onDestroy()"-->(*)

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 60 of 127

Page 62: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.12 Complete example 4 ACTIVITY DIAGRAM

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 61 of 127

Page 63: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

4.12 Complete example 4 ACTIVITY DIAGRAM

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 62 of 127

Page 64: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5 ACTIVITY DIAGRAM (BETA)

5 Activity Diagram (beta)

Current syntax for activity diagram has several limitations and drawbacks (for example, it’s difficultto maintain).So a completely new syntax and implementation is proposed as beta version to users (startingwith V7947), so that we could define a better format and syntax.Another advantage of this new implementation is that it’s done without the need of having Graphvizinstalled (as for sequence diagrams).The new syntax will replace the old one. However, for compatibility reason, the old syntax will stillbe recognized, to ensure ascending compatibility.Users are simply encouraged to migrate to the new syntax.

5.1 Simple Activity

Activities label starts with : and ends with ;.Text formatting can be done using creole wiki syntax.They are implicitly linked in their definition order.@startuml:Hello world;:This is on defined onseveral **lines**;@enduml

5.2 Start/Stop

You can use start and stop keywords to denote the beginning and the end of a diagram.@startumlstart:Hello world;:This is on defined onseveral **lines**;stop@enduml

You can also use the end keyword.

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 63 of 127

Page 65: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.3 Conditional 5 ACTIVITY DIAGRAM (BETA)

@startumlstart:Hello world;:This is on defined onseveral **lines**;end@enduml

5.3 Conditional

You can use if, then and else keywords to put tests if your diagram. Labels can be providedusing parentheses.@startuml

start

if (Graphviz installed?) then (yes):process all\ndiagrams;else (no):process only__sequence__ and __activity__ diagrams;endif

stop

@enduml

You can use the elseif keyword to have several tests :@startumlstartif (condition A) then (yes):Text 1;elseif (condition B) then (yes):Text 2;stopelseif (condition C) then (yes):Text 3;elseif (condition D) then (yes):Text 4;

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 64 of 127

Page 66: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.4 Repeat loop 5 ACTIVITY DIAGRAM (BETA)

else (nothing):Text else;endifstop@enduml

5.4 Repeat loop

You can use repeat and repeatwhile keywords to have repeat loops.@startuml

start

repeat:read data;:generate diagrams;repeat while (more data?)

stop

@enduml

5.5 While loop

You can use while and end while keywords to have repeat loops.@startuml

start

while (data available?)

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 65 of 127

Page 67: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.6 Parallel processing 5 ACTIVITY DIAGRAM (BETA)

:read data;:generate diagrams;endwhile

stop

@enduml

It is possible to provide a label after the endwhile keyword, or using the is keyword.@startumlwhile (check filesize ?) is (not empty):read file;endwhile (empty):close file;@enduml

5.6 Parallel processing

You can use fork, fork again and end fork keywords to denote parallel processing.@startuml

start

if (multiprocessor?) then (yes)fork:Treatment 1;fork again:Treatment 2;end forkelse (monoproc):Treatment 1;:Treatment 2;endif

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 66 of 127

Page 68: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.7 Notes 5 ACTIVITY DIAGRAM (BETA)

5.7 Notes

Text formatting can be done using creole wiki syntax.A note can be floating, using floating keyword.@startuml

start:foo1;floating note left: This is a note:foo2;note rightThis note is on several//lines// and cancontain <b>HTML</b>====* Calling the method ""foo()"" is prohibitedend notestop

@enduml

5.8 Colors

You can use specify a color for some activities.@startuml

start:starting progress;#HotPink:reading configuration filesThese files should edited at this point!;#AAAAAA:ending of the process;

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 67 of 127

Page 69: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.9 Arrows 5 ACTIVITY DIAGRAM (BETA)

5.9 Arrows

Using the -> notation, you can add texts to arrow, and change their color.It’s also possible to have dotted, dashed, bold or hidden arrows.@startuml:foo1;-> You can put text on arrows;if (test) then-[#blue]->:foo2;-[#green,dashed]-> The text canalso be on several linesand **very** long...;:foo3;else-[#black,dotted]->:foo4;endif-[#gray,bold]->:foo5;@enduml

5.10 Grouping

You can group activity together by defining partition:@startumlstartpartition Initialization {:read config file;

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 68 of 127

Page 70: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.11 Swimlanes 5 ACTIVITY DIAGRAM (BETA)

:init internal variable;}partition Running {:wait for user interaction;:print information;}

stop@enduml

5.11 Swimlanes

Using pipe |, you can define swimlanes.It’s also possible to change swimlanes color.@startuml|Swimlane1|start:foo1;|#AntiqueWhite|Swimlane2|:foo2;:foo3;|Swimlane1|:foo4;|Swimlane2|:foo5;stop@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 69 of 127

Page 71: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.12 Detach 5 ACTIVITY DIAGRAM (BETA)

5.12 Detach

It’s possible to remove an arrow using the detach keyword.@startuml:start;fork:foo1;:foo2;fork again:foo3;detachendforkif (foo4) then:foo5;detachendif:foo6;detach:foo7;stop@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 70 of 127

Page 72: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.13 SDL 5 ACTIVITY DIAGRAM (BETA)

5.13 SDL

By changing the final ; separator, you can set different rendering for the activity:

• |• <

• >

• /• ]• }

@startuml:Ready;:next(o)|:Receiving;split:nak(i)<:ack(o)>split again:ack(i)<:next(o)on several line|:i := i + 1]:ack(o)>split again:err(i)<:nak(o)>split again:foo/split again:i > 5}stopend split:finish;@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 71 of 127

Page 73: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.14 Complete example 5 ACTIVITY DIAGRAM (BETA)

5.14 Complete example

@startuml

start:ClickServlet.handleRequest();:new page;if (Page.onSecurityCheck) then (true):Page.onInit();if (isForward?) then (no):Process controls;if (continue processing?) then (no)stopendif

if (isPost?) then (yes):Page.onPost();else (no):Page.onGet();endif:Page.onRender();endifelse (false)endif

if (do redirect?) then (yes):redirect process;elseif (do forward?) then (yes):Forward request;else (no):Render page template;endifendif

stop

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 72 of 127

Page 74: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

5.14 Complete example 5 ACTIVITY DIAGRAM (BETA)

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 73 of 127

Page 75: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6 COMPONENT DIAGRAM

6 Component Diagram

6.1 Components

Components must be bracketed.You can also use the component keyword to defines a component. And you can define an alias,using the as keyword. This alias will be used latter, when defining relations.@startuml

[First component][Another component] as Comp2component Comp3component [Last\ncomponent] as Comp4

@enduml

6.2 Interfaces

Interface can be defined using the () symbol (because this looks like a circle).You can also use the interface keyword to defines an interface. And you can define an alias, usingthe as keyword. This alias will be used latter, when defining relations.We will see latter that interface definition is optional.@startuml

() "First Interface"() "Another interface" as Interf2interface Interf3interface "Last\ninterface" as Interf4

@enduml

6.3 Basic example

Links between elements are made using combinations of dotted line (..), straight line (--), andarrows (-->) symbols.

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 74 of 127

Page 76: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6.4 Using notes 6 COMPONENT DIAGRAM

@startuml

DataAccess - [First Component][First Component] ..> HTTP : use

@enduml

6.4 Using notes

You can use the note left of , note right of , note top of , note bottom of keywords todefine notes related to a single object.A note can be also define alone with the note keywords, then linked to other objects using the ..symbol.@startuml

interface "Data Access" as DA

DA - [First Component][First Component] ..> HTTP : use

note left of HTTP : Web Service only

note right of [First Component]A note can alsobe on several linesend note

@enduml

6.5 Grouping Components

You can use several keywords to group components and interfaces together:

• package• node

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 75 of 127

Page 77: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6.5 Grouping Components 6 COMPONENT DIAGRAM

• folder• frame• cloud• database

@startuml

package "Some Group" {HTTP - [First Component][Another Component]}

node "Other Groups" {FTP - [Second Component][First Component] --> FTP}

cloud {[Example 1]}

database "MySql" {folder "This is my folder" {[Folder 3]}frame "Foo" {[Frame 4]}}

[Another Component] --> [Example 1][Example 1] --> [Folder 3][Folder 3] --> [Frame 4]

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 76 of 127

Page 78: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6.6 Changing arrows direction 6 COMPONENT DIAGRAM

6.6 Changing arrows direction

By default, links between classes have two dashes -- and are vertically oriented. It is possible touse horizontal link by putting a single dash (or dot) like this:@startuml[Component] --> Interface1[Component] -> Interface2@enduml

You can also change directions by reversing the link:@startumlInterface1 <-- [Component]Interface2 <- [Component]@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 77 of 127

Page 79: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6.7 Use UML2 notation 6 COMPONENT DIAGRAM

It is also possible to change arrow direction by adding left, right, up or down keywords inside thearrow:@startuml[Component] -left-> left[Component] -right-> right[Component] -up-> up[Component] -down-> down@enduml

You can shorten the arrow by using only the first character of the direction (for example, -d-instead of -down-) or the two first characters (-do-).Please note that you should not abuse this functionality : Graphviz gives usually good resultswithout tweaking.

6.7 Use UML2 notation

The skinparam componentStyle uml2 command is used to switch to UML2 notation.@startumlskinparam componentStyle uml2

interface "Data Access" as DA

DA - [First Component][First Component] ..> HTTP : use

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 78 of 127

Page 80: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6.8 Long description 6 COMPONENT DIAGRAM

6.8 Long description

It is possible to put description on several lines using square brackets.@startumlcomponent comp1 [This componenthas a long commenton several lines]@enduml

6.9 Individual colors

You can specify a color after component definition.@startumlcomponent [Web Server] #Yellow@enduml

6.10 Using Sprite in Stereotype

You can use sprites within stereotype components.@startumlsprite $businessProcess [16x16/16] {FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFFFFFFFFFFFFFF00FFFFFF00000000000FFFFF000000000000FFFF00000000000FFFFFFFFFFFFF00FFFFFFFFFFFFFF0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 79 of 127

Page 81: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6.11 Skinparam 6 COMPONENT DIAGRAM

FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}

rectangle " End to End\nbusiness process" <<$businessProcess>> {rectangle "inner process 1" <<$businessProcess>> as srcrectangle "inner process 2" <<$businessProcess>> as tgtsrc -> tgt}@enduml

6.11 Skinparam

You can use the skinparam command to change colors and fonts for the drawing.You can use this command :

• In the diagram definition, like any other commands,• In an included file,• In a configuration file, provided in the command line or the ANT task.

You can define specific color and fonts for stereotyped components and interfaces.@startuml

skinparam interface {backgroundColor RosyBrownborderColor orange}

skinparam component {FontSize 13BackgroundColor<<Apache>> RedBorderColor<<Apache>> #FF6655FontName CourierBorderColor blackBackgroundColor goldArrowFontName ImpactArrowColor #FF6655ArrowFontColor #777777}

() "Data Access" as DA

DA - [First Component][First Component] ..> () HTTP : useHTTP - [Web Server] << Apache >>

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 80 of 127

Page 82: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

6.11 Skinparam 6 COMPONENT DIAGRAM

@startuml[AA] <<static lib>>[BB] <<shared lib>>[CC] <<static lib>>

node node1node node2 <<shared node>>database Production

skinparam component {backgroundColor<<static lib>> DarkKhakibackgroundColor<<shared lib>> Green}

skinparam node {borderColor GreenbackgroundColor YellowbackgroundColor<<shared node>> Magenta}skinparam databaseBackgroundColor Aqua

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 81 of 127

Page 83: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

7 STATE DIAGRAM

7 State Diagram

7.1 Simple State

You can use [*] for the starting point and ending point of the state diagram.Use --> for arrows.@startuml

[*] --> State1State1 --> [*]State1 : this is a stringState1 : this is another string

State1 -> State2State2 --> [*]

@enduml

7.2 Composite state

A state can also be composite. You have to define it using the state keywords and brackets.@startumlscale 350 width[*] --> NotShooting

state NotShooting {[*] --> IdleIdle --> Configuring : EvConfigConfiguring --> Idle : EvConfig}

state Configuring {[*] --> NewValueSelectionNewValueSelection --> NewValuePreview : EvNewValueNewValuePreview --> NewValueSelection : EvNewValueRejectedNewValuePreview --> NewValueSelection : EvNewValueSaved

state NewValuePreview {State1 -> State2}

}@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 82 of 127

Page 84: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

7.3 Long name 7 STATE DIAGRAM

7.3 Long name

You can also use the state keyword to use long description for states.@startumlscale 600 width

[*] -> State1State1 --> State2 : SucceededState1 --> [*] : AbortedState2 --> State3 : SucceededState2 --> [*] : Abortedstate State3 {state "Accumulate Enough Data\nLong State Name" as long1long1 : Just a test[*] --> long1long1 --> long1 : New Datalong1 --> ProcessData : Enough Data}State3 --> State3 : FailedState3 --> [*] : Succeeded / Save ResultState3 --> [*] : Aborted

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 83 of 127

Page 85: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

7.4 Concurrent state 7 STATE DIAGRAM

7.4 Concurrent state

You can define concurrent state into a composite state using either -- or || symbol as separator.@startuml[*] --> Active

state Active {[*] -> NumLockOffNumLockOff --> NumLockOn : EvNumLockPressedNumLockOn --> NumLockOff : EvNumLockPressed--[*] -> CapsLockOffCapsLockOff --> CapsLockOn : EvCapsLockPressedCapsLockOn --> CapsLockOff : EvCapsLockPressed--[*] -> ScrollLockOffScrollLockOff --> ScrollLockOn : EvCapsLockPressedScrollLockOn --> ScrollLockOff : EvCapsLockPressed}

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 84 of 127

Page 86: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

7.5 Arrow direction 7 STATE DIAGRAM

7.5 Arrow direction

You can use -> for horizontal arrows. It is possible to force arrow’s direction using the followingsyntax:

• -down-> (default arrow)• -right-> or ->• -left->• -up->

@startuml

[*] -up-> FirstFirst -right-> SecondSecond --> ThirdThird -left-> Last

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 85 of 127

Page 87: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

7.6 Note 7 STATE DIAGRAM

You can shorten the arrow by using only the first character of the direction (for example, -d-instead of -down-) or the two first characters (-do-).Please note that you should not abuse this functionality : Graphviz gives usually good resultswithout tweaking.

7.6 Note

You can also define notes using note left of, note right of, note top of, note bottom ofkeywords.You can also define notes on several lines.@startuml

[*] --> ActiveActive --> Inactive

note left of Active : this is a short\nnote

note right of InactiveA note can alsobe defined onseveral linesend note

@enduml

You can also have floating notes.@startuml

state foonote "This is a floating note" as N1

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 86 of 127

Page 88: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

7.7 More in notes 7 STATE DIAGRAM

7.7 More in notes

You can put notes on composite states.@startuml

[*] --> NotShooting

state "Not Shooting State" as NotShooting {state "Idle mode" as Idlestate "Configuring mode" as Configuring[*] --> IdleIdle --> Configuring : EvConfigConfiguring --> Idle : EvConfig}

note right of NotShooting : This is a note on a composite state

@enduml

7.8 Skinparam

You can use the skinparam command to change colors and fonts for the drawing.You can use this command :

• In the diagram definition, like any other commands,• In an included file,• In a configuration file, provided in the command line or the ANT task.

You can define specific color and fonts for stereotyped states.@startumlskinparam backgroundColor LightYellowskinparam state {StartColor MediumBlueEndColor RedBackgroundColor PeruBackgroundColor<<Warning>> OliveBorderColor GrayFontName Impact}

[*] --> NotShooting

state "Not Shooting State" as NotShooting {

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 87 of 127

Page 89: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

7.8 Skinparam 7 STATE DIAGRAM

state "Idle mode" as Idle <<Warning>>state "Configuring mode" as Configuring[*] --> IdleIdle --> Configuring : EvConfigConfiguring --> Idle : EvConfig}

NotShooting --> [*]@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 88 of 127

Page 90: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

8 OBJECT DIAGRAM

8 Object Diagram

8.1 Definition of objects

You define instance of objects using the object keywords.@startumlobject firstObjectobject "My Second Object" as o2@enduml

8.2 Relations between objects

Relations between objects are defined using the following symbols :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.@startumlobject Object01object Object02object Object03object Object04object Object05object Object06object Object07object Object08

Object01 <|-- Object02Object03 *-- Object04Object05 o-- "4" Object06Object07 .. Object08 : some labels@enduml

8.3 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

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 89 of 127

Page 91: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

8.4 Common features with class diagrams 8 OBJECT DIAGRAM

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

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

@enduml

8.4 Common features with class diagrams• Visibility• Defines notes• Use packages• Skin the output

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 90 of 127

Page 92: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

9 COMMON COMMANDS

9 Common commands

9.1 Comentários

Tudo que começar com aspa simples ' é um comentário.Você também pode colocar comentário em diversas linhas colocando /' para iniciar e '/ parafinalizar.

9.2 Footer and header

You can use the commands header or footer to add a footer or a header on any generated diagram.You can optionally specify if you want a center, left or right footer/header, by adding a keyword.As for title, it is possible to define a header or a footer on several lines.It is also possible to put some HTML into the header or footer.@startumlAlice -> Bob: Authentication Request

header<font color=red>Warning:</font>Do not use in production.endheader

center footer Generated for demonstration

@enduml

9.3 Zoom

You can use the scale command to zoom the generated image.You can use either a number or a fraction to define the scale factor. You can also specify eitherwidth or height (in pixel). And you can also give both width and height : the image is scaled to fitinside the specified dimension.

• scale 1.5• scale 2/3• scale 200 width• scale 200 height• scale 200*100• scale max 300*200• scale max 1024 width• scale max 800 height

@startumlscale 180*90Bob->Alice : hello@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 91 of 127

Page 93: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

9.4 Título 9 COMMON COMMANDS

9.4 Título

A palavra-chave title é utilizada para colocar um título na figura. Você pode inserir nova linhautilizando \n na descrição do título.Some skinparam settings are available to put borders on the title.@startumlskinparam titleBorderRoundCorner 15skinparam titleBorderThickness 2skinparam titleBorderColor redskinparam titleBackgroundColor Aqua-CadetBlue

title Simple communication\nexample

Alice -> Bob: Authentication RequestBob --> Alice: Authentication Response

@enduml

Você pode utilizar formatação nativa no título.Você também pode definir título em diversas linhas usando as palavras-chave title e end title.@startuml

title<u>Simple</u> communication exampleon <i>several</i> lines and using <back:cadetblue>creole tags</back>end title

Alice -> Bob: Authentication RequestBob -> Alice: Authentication Response

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 92 of 127

Page 94: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

9.5 Caption 9 COMMON COMMANDS

9.5 Caption

There is also a caption keyword to put a caption under the diagram.@startuml

caption figure 1Alice -> Bob: Hello

@enduml

9.6 Legenda para o diagrama

As palavras chaves legend e end legend são usadas para a definição de uma legenda.Você pode opcionalmente especificar ter o tipo de alinhamento left, right ou center para alegenda.@startuml

Alice -> Bob : Hellolegend rightShortlegendendlegend

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 93 of 127

Page 95: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

10 SALT

10 Salt

Salt is a subproject included in PlantUML that may help you to design graphical interface.You can use either @startsalt keyword, or @startuml followed by a line with salt keyword.

10.1 Basic widgets

A window must start and end with brackets. You can then define:

• Button using [ and ].• Radio button using ( and ).• Checkbox using [ and ].• User text area using ".

@startumlsalt{Just plain text[This is my button]() Unchecked radio(X) Checked radio[] Unchecked box[X] Checked box"Enter text here "^This is a droplist^}@enduml

The goal of this tool is to discuss about simple and sample windows.

10.2 Using grid

A table is automatically created when you use an opening bracket {.And you have to use | to separate columns.For example:@startsalt{Login | "MyName "Password | "**** "[Cancel] | [ OK ]}@endsalt

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 94 of 127

Page 96: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

10.3 Using separator 10 SALT

Just after the opening bracket, you can use a character to define if you want to draw lines or columnsof the grid :# To display all vertical and horizontal lines! To display all vertical lines- To display all horizontal lines+ To display external lines@startsalt{+Login | "MyName "Password | "**** "[Cancel] | [ OK ]}@endsalt

10.3 Using separator

You can use several horizontal lines as separator.@startsalt{Text1.."Some field"==Note on usage~~Another text--[Ok]}@endsalt

10.4 Tree widget

To have a Tree, you have to start with {T and to use + to denote hierarchy.@startsalt{{T+ World++ America+++ Canada+++ USA++++ New York++++ Boston+++ Mexico++ Europe+++ Italy+++ Germany++++ Berlin

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 95 of 127

Page 97: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

10.5 Enclosing brackets 10 SALT

++ Africa}}@endsalt

10.5 Enclosing brackets

You can define subelements by opening a new opening bracket.@startsalt{Name | " "Modifiers: | { (X) public | () default | () private | () protected[] abstract | [] final | [] static }Superclass: | { "java.lang.Object " | [Browse...] }}@endsalt

10.6 Adding tabs

You can add tabs using {/ notation. Note that you can use HTML code to have bold text.@startsalt{+{/ <b>General | Fullscreen | Behavior | Saving }{{ Open image in: | ^Smart Mode^ }[X] Smooth images when zoomed[X] Confirm image deletion[ ] Show hidden images}[Close]}@endsalt

Tab could also be vertically oriented:

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 96 of 127

Page 98: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

10.7 Using menu 10 SALT

@startsalt{+{/ <b>GeneralFullscreenBehaviorSaving } |{{ Open image in: | ^Smart Mode^ }[X] Smooth images when zoomed[X] Confirm image deletion[ ] Show hidden images[Close]}}@endsalt

10.7 Using menu

You can add a menu by using {* notation.@startsalt{+{* File | Edit | Source | Refactor }{/ General | Fullscreen | Behavior | Saving }{{ Open image in: | ^Smart Mode^ }[X] Smooth images when zoomed[X] Confirm image deletion[ ] Show hidden images}[Close]}@endsalt

It is also possible to open a menu:@startsalt{+{* File | Edit | Source | RefactorRefactor | New | Open File | - | Close | Close All }{/ General | Fullscreen | Behavior | Saving }{{ Open image in: | ^Smart Mode^ }[X] Smooth images when zoomed[X] Confirm image deletion[ ] Show hidden images}[Close]}@endsalt

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 97 of 127

Page 99: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

10.8 Advanced table 10 SALT

10.8 Advanced table

You can use two special notations for table :

• * to indicate that a cell with span with left• . to denotate an empty cell

@startsalt{#. | Column 2 | Column 3Row header 1 | value 1 | value 2Row header 2 | A long cell | *}@endsalt

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 98 of 127

Page 100: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11 CREOLE

11 Creole

A light Creole engine have been integrated into PlantUML to have a standardized way of definingtext style.All diagrams are now supporting this syntax.Note that ascending compatibility with HTML syntax is preserved.

11.1 Emphasized text

@startumlAlice -> Bob : hello --there--... Some ~~long delay~~ ...Bob -> Alice : oknote leftThis is **bold**This is //italics//This is ""monospaced""This is --stroked--This is __underlined__This is ~~waved~~end note@enduml

11.2 List

@startumlobject demo {* Bullet list* Second item}note left* Bullet list* Second item** Sub itemend note

legend# Numbered list# Second item## Sub item## Another sub item# Third itemend legend@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 99 of 127

Page 101: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.3 Escape character 11 CREOLE

11.3 Escape character

You can use the tilde ~ to escape special creole characters.@startumlobject demo {This is not ~___underscored__.This is not ~""monospaced"".}@enduml

11.4 Horizontal lines

@startumldatabase DB1 as "You can have horizontal line----Or double line====Or strong line____Or dotted line..My title..Enjoy!"note rightThis is working also in notesYou can also add title in all these lines==Title==--Another title--end note

@enduml

11.5 Headings

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 100 of 127

Page 102: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.6 Legacy HTML 11 CREOLE

@startumlusecase UC1 as "= Extra-large headingSome text== Large headingOther text=== Medium headingInformation....==== Small heading"@enduml

11.6 Legacy HTML

Some HTML tags are also working:

• <b> for bold text• <u> or <u:#AAAAAA> or <u:colorName> for underline• <i> for italic• <s> or <s:#AAAAAA> or <s:colorName> for strike text• <w> or <w:#AAAAAA> or <w:colorName> for wave underline text• <color:#AAAAAA> or <color:colorName>• <back:#AAAAAA> or <back:colorName> for background color• <size:nn> to change font size• <img:file> : the file must be accessible by the filesystem• <img:http://url> : the URL must be available from the Internet

@startuml:* You can change <color:red>text color</color>* You can change <back:cadetblue>background color</back>* You can change <size:18>size</size>* You use <u>legacy</u> <b>HTML <i>tag</i></b>* You use <u:red>color</u> <s:green>in HTML</s> <w:#0000FF>tag</w>----* Use image : <img:sourceforge.jpg>;

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 101 of 127

Page 103: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.7 Table 11 CREOLE

11.7 Table

It is possible to build table.@startumlskinparam titleFontSize 14titleExample of simple table|= |= table |= header || a | table | row || b | table | row |end title[*] --> State1@enduml

You can specify background colors for cells and lines.@startumlstart:Here is the result|= |= table |= header || a | table | row ||<#FF8080> red |<#80FF80> green |<#8080FF> blue |<#yellow>| b | table | row |;@enduml

11.8 Tree

You can use |_ characters to build a tree.@startumlskinparam titleFontSize 14titleExample of Tree|_ First line|_ **Bom(Model)**|_ prop1|_ prop2|_ prop3|_ Last lineend title[*] --> State1@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 102 of 127

Page 104: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.9 Special characters 11 CREOLE

11.9 Special characters

It’s possible to use any unicode characters with &# syntax or <U+XXXX>@startumlusecase foo as "this is &#8734; long"usecase bar as "this is also <U+221E> long"@enduml

11.10 OpenIconic

OpenIconic is an very nice open source icon set. Those icons have been integrated into the creoleparser, so you can use them out-of-the-box.You can use the following syntax: <&ICON_NAME>.@startumltitle: <size:20><&heart>Use of OpenIconic <&heart></size>class Wifinote leftClick on <&wifi>end note@enduml

The complete list is available on OpenIconic Website, or you can use the following special diagram:@startumllistopeniconic@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 103 of 127

Page 105: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.10 OpenIconic 11 CREOLE

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 104 of 127

Page 106: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.11 Defining and using sprites 11 CREOLE

11.11 Defining and using sprites

A Sprite is a small graphic element that can be used in diagrams.In PlantUML, sprites are monochrome and can have either 4, 8 or 16 gray level.To define a sprite, you have to use a hexadecimal digit between 0 and F per pixel.Then you can use the sprite using <$XXX> where XXX is the name of the sprite.@startumlsprite $foo1 {FFFFFFFFFFFFFFFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFFFFFFFFFFFFFFFF}Alice -> Bob : Testing <$foo1>@enduml

You can scale the sprite.@startumlsprite $foo1 {FFFFFFFFFFFFFFFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFF0123456789ABCFFFFFFFFFFFFFFFF}Alice -> Bob : Testing <$foo1{scale=3}>@enduml

11.12 Encoding Sprite

To encode sprite, you can use the command line like:

java -jar plantuml.jar -encodesprite 16z foo.png

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 105 of 127

Page 107: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.13 Importing Sprite 11 CREOLE

where foo.png is the image file you want to use (it will be converted to gray automatically).After -encodesprite, you have to specify a format: 4, 8, 16, 4z, 8z or 16z.The number indicates the gray level and the optional z is used to enable compression in spritedefinition.

11.13 Importing Sprite

You can also launch the GUI to generate a sprite from an existing image.Click in the menubar then on File/Open Sprite Window.

After copying an image into you clipboard, several possible definitions of the corresponding spritewill be displayed : you will just have to pickup the one you want.

11.14 Examples

@startumlsprite $printer [15x15/8z] NOtH3W0W208HxFz_kMAhj7lHWpa1XC716sz0Pq4MVPEWfBHIuxP3L6kbTcizR8tAhzaqFvXwvFfPEqm0start:click on <$printer> to print the page;@enduml

@startumlsprite $bug [15x15/16z] PKzR2i0m2BFMi15p__FEjQEqB1z27aeqCqixa8S4OT7C53cKpsHpaYPDJY_12MHM -BLRyywPhrrlw3qumqNThmXgd1TOterAZmOW8sgiJafogofWRwtV3nCFsprite $printer [15x15/8z] NOtH3W0W208HxFz_kMAhj7lHWpa1XC716sz0Pq4MVPEWfBHIuxP3L6kbTcizR8tAhzaqFvXwvFfPEqm0sprite $disk {44444556667788143600000000999143600000000ACA153700000001A7A153700000012B8A153800000123B8A163800001233C9A1634999AABBC99B1744566778899AB17456AAAAA99AAB18566AFC228AABB18567AC8118BBBB1867BD4433BBBBB139AAAAABBBBBBC1}

title Use of sprites (<$printer>, <$bug>...)

class Example {Can have some bug : <$bug>Click on <$disk> to save}

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 106 of 127

Page 108: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

11.14 Examples 11 CREOLE

note left : The printer <$printer> is available

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 107 of 127

Page 109: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

12 ATERANDO FONTES E CORES

12 Aterando fontes e cores

12.1 Uso

Você pode mudar a cor e fonte de desenhos usando o comando skinparam. Exemplo:skinparam backgroundColor yellow

Este comando pode ser utilizado:

• Na definição de diagramas, assim como outros comandos,• Em um arquivo incluído (veja Pré-Processamento),• Em um arquivo de configuração, disponibilizado na linha de comando ou na ANT task.

12.2 Nested

To avoid repetition, it is possible to nest definition. So the following definition :skinparam xxxxParam1 value1skinparam xxxxParam2 value2skinparam xxxxParam3 value3skinparam xxxxParam4 value4

is strictly equivalent to:skinparam xxxx {

Param1 value1Param2 value2Param3 value3Param4 value4

}

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 108 of 127

Page 110: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

12.3 Color 12 ATERANDO FONTES E CORES

12.3 Color

You can use either standard color name or RGB code.

Parameter name Default Color CommentValue

backgroundColor white Background of the pageactivityArrowColor #A80036 Color of arrows in activity diagramsactivityBackgroundColor #FEFECE Background of activitiesactivityBorderColor #A80036 Color of activity bordersactivityStartColor black Starting circle in activity diagramsactivityEndColor black Ending circle in activity diagramsactivityBarColor black Synchronization bar in activity diagramsusecaseArrowColor #A80036 Color of arrows in usecase diagramsusecaseActorBackgroundColor #FEFECE Head’s color of actor in usecase diagramsusecaseActorBorderColor #A80036 Color of actor borders in usecase diagramsusecaseBackgroundColor #FEFECE Background of usecasesusecaseBorderColor #A80036 Color of usecase borders in usecase diagramsclassArrowColor #A80036 Color of arrows in class diagramsclassBackgroundColor #FEFECE Background of classes/interface/enum in class diagramsclassBorderColor #A80036 Borders of classes/interface/enum in class diagramspackageBackgroundColor #FEFECE Background of packages in class diagramspackageBorderColor #A80036 Borders of packages in class diagramsstereotypeCBackgroundColor #ADD1B2 Background of class spots in class diagramsstereotypeABackgroundColor #A9DCDF Background of abstract class spots in class diagramsstereotypeIBackgroundColor #B4A7E5 Background of interface spots in class diagramsstereotypeEBackgroundColor #EB937F Background of enum spots in class diagramscomponentArrowColor #A80036 Color of arrows in component diagramscomponentBackgroundColor #FEFECE Background of componentscomponentBorderColor #A80036 Borders of componentscomponentInterfaceBackgroundColor #FEFECE Background of interface in component diagramscomponentInterfaceBorderColor #A80036 Border of interface in component diagramsnoteBackgroundColor #FBFB77 Background of notesnoteBorderColor #A80036 Border of notesstateBackgroundColor #FEFECE Background of states in state diagramsstateBorderColor #A80036 Border of states in state diagramsstateArrowColor #A80036 Colors of arrows in state diagramsstateStartColor black Starting circle in state diagramsstateEndColor black Ending circle in state diagramssequenceArrowColor #A80036 Color of arrows in sequence diagramssequenceActorBackgroundColor #FEFECE Head’s color of actor in sequence diagramssequenceActorBorderColor #A80036 Border of actor in sequence diagramssequenceGroupBackgroundColor #EEEEEE Header color of alt/opt/loop in sequence diagramssequenceLifeLineBackgroundColor white Background of life line in sequence diagramssequenceLifeLineBorderColor #A80036 Border of life line in sequence diagramssequenceParticipantBackgroundColor #FEFECE Background of participant in sequence diagramssequenceParticipantBorderColor #A80036 Border of participant in sequence diagrams

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 109 of 127

Page 111: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

12.4 Font color, name and size 12 ATERANDO FONTES E CORES

12.4 Font color, name and size

You can change the font for the drawing using xxxFontColor, xxxFontSize and xxxFontNameparameters.Example:skinparam classFontColor redskinparam classFontSize 10skinparam classFontName Aapex

You can also change the default font for all fonts using skinparam defaultFontName.Example:skinparam defaultFontName Aapex

Please note the fontname is highly system dependent, so do not over use it, if you look for portability.

Parameter Default CommentName ValueactivityFontColor black

Used for activity boxactivityFontSize 14activityFontStyle plainactivityFontNameactivityArrowFontColor black

Used for text on arrows in activity diagramsactivityArrowFontSize 13activityArrowFontStyle plainactivityArrowFontNamecircledCharacterFontColor black

Used for text in circle for class, enum and otherscircledCharacterFontSize 17circledCharacterFontStyle boldcircledCharacterFontName CouriercircledCharacterRadius 11classArrowFontColor black

Used for text on arrows in class diagramsclassArrowFontSize 10classArrowFontStyle plainclassArrowFontNameclassAttributeFontColor black

Class attributes and methodsclassAttributeFontSize 10classAttributeIconSize 10classAttributeFontStyle plainclassAttributeFontNameclassFontColor black

Used for classes nameclassFontSize 12classFontStyle plainclassFontNameclassStereotypeFontColor black

Used for stereotype in classesclassStereotypeFontSize 12classStereotypeFontStyle italicclassStereotypeFontNamecomponentFontColor black

Used for components namecomponentFontSize 14componentFontStyle plaincomponentFontNamecomponentStereotypeFontColor black

Used for stereotype in componentscomponentStereotypeFontSize 14componentStereotypeFontStyle italiccomponentStereotypeFontName

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 110 of 127

Page 112: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

12.4 Font color, name and size 12 ATERANDO FONTES E CORES

componentArrowFontColor black

Used for text on arrows in component diagramscomponentArrowFontSize 13componentArrowFontStyle plaincomponentArrowFontNamenoteFontColor black

Used for notes in all diagrams but sequence diagramsnoteFontSize 13noteFontStyle plainnoteFontNamepackageFontColor black

Used for package and partition namespackageFontSize 14packageFontStyle plainpackageFontNamesequenceActorFontColor black

Used for actor in sequence diagramssequenceActorFontSize 13sequenceActorFontStyle plainsequenceActorFontNamesequenceDividerFontColor black

Used for text on dividers in sequence diagramssequenceDividerFontSize 13sequenceDividerFontStyle boldsequenceDividerFontNamesequenceArrowFontColor black

Used for text on arrows in sequence diagramssequenceArrowFontSize 13sequenceArrowFontStyle plainsequenceArrowFontNamesequenceGroupingFontColor black

Used for text for ”else” in sequence diagramssequenceGroupingFontSize 11sequenceGroupingFontStyle plainsequenceGroupingFontNamesequenceGroupingHeaderFontColor black

Used for text for ”alt/opt/loop” headers in sequence diagramssequenceGroupingHeaderFontSize 13sequenceGroupingHeaderFontStyle plainsequenceGroupingHeaderFontNamesequenceParticipantFontColor black

Used for text on participant in sequence diagramssequenceParticipantFontSize 13sequenceParticipantFontStyle plainsequenceParticipantFontNamesequenceTitleFontColor black

Used for titles in sequence diagramssequenceTitleFontSize 13sequenceTitleFontStyle plainsequenceTitleFontNametitleFontColor black

Used for titles in all diagrams but sequence diagramstitleFontSize 18titleFontStyle plaintitleFontNamestateFontColor black

Used for states in state diagramsstateFontSize 14stateFontStyle plainstateFontNamestateArrowFontColor black

Used for text on arrows in state diagramsstateArrowFontSize 13stateArrowFontStyle plainstateArrowFontNamestateAttributeFontColor black

Used for states description in state diagramsstateAttributeFontSize 12stateAttributeFontStyle plainstateAttributeFontName

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 111 of 127

Page 113: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

12.4 Font color, name and size 12 ATERANDO FONTES E CORES

usecaseFontColor black

Used for usecase labels in usecase diagramsusecaseFontSize 14usecaseFontStyle plainusecaseFontNameusecaseStereotypeFontColor black

Used for stereotype in usecaseusecaseStereotypeFontSize 14usecaseStereotypeFontStyle italicusecaseStereotypeFontNameusecaseActorFontColor black

Used for actor labels in usecase diagramsusecaseActorFontSize 14usecaseActorFontStyle plainusecaseActorFontNameusecaseActorStereotypeFontColor black

Used for stereotype for actorusecaseActorStereotypeFontSize 14usecaseActorStereotypeFontStyle italicusecaseActorStereotypeFontNameusecaseArrowFontColor black

Used for text on arrows in usecase diagramsusecaseArrowFontSize 13usecaseArrowFontStyle plainusecaseArrowFontNamefooterFontColor black

Used for footerfooterFontSize 10footerFontStyle plainfooterFontNameheaderFontColor black

Used for headerheaderFontSize 10headerFontStyle plainheaderFontName

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 112 of 127

Page 114: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

12.5 Black and White 12 ATERANDO FONTES E CORES

12.5 Black and White

You can force the use of a black white output using the skinparam monochrome true command.@startumlskinparam monochrome true

actor Userparticipant "First Class" as Aparticipant "Second Class" as Bparticipant "Last Class" as C

User -> A: DoWorkactivate A

A -> B: Create Requestactivate B

B -> C: DoWorkactivate CC --> B: WorkDonedestroy C

B --> A: Request Createddeactivate B

A --> User: Donedeactivate A

@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 113 of 127

Page 115: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

13 PREPROCESSING

13 Preprocessing

Some minor preprocessing capabilities are included in PlantUML, and available for all diagrams.Those functionnalities are very similar to the C language preprocessor, except that the specialcharacter (#) has been changed to the exclamation mark (!).

13.1 Including files

Use the !include directive to include file in your diagram.Imagine you have the very same class that appears in many diagrams. Instead of duplicating thedescription of this class, you can define a file that contains the description.@startuml!include List.iumlList <|.. ArrayList@enduml

File List.iuml: interface List List : int size() List : void clear()The file List.iuml can be included in many diagrams, and any modification in this file will changeall diagrams that include it.A file can be only be included once. If you want to include several times the very same file, youhave to use the directive !include_many instead of !include.You can also put several @startuml/@enduml text block in an included file and then specify whichblock you want to include adding !0 where 0 is the block number.For example, if you use !include foo.txt!1, the second @startuml/@enduml block within foo.txtwill be included.You can also put an id to some @startuml/@enduml text block in an included file using @startuml(id=MY_OWN_ID)syntax and then include the block adding !MY_OWN_ID when including the file, so using somethinglike !include foo.txt!MY_OWN_ID.

13.2 Including URL

Use the !includeurl directive to include file from Internet/Intranet in your diagram.You can also use !includeurl http://someurl.com/mypath!0 to specify which @startuml/@endumlblock from http://someurl.com/mypath you want to include. The !0 notation denotes the firstdiagram.

13.3 Constant definition

You can define constant using the !define directive. As in C language, a constant name can onlyuse alphanumeric and underscore characters, and cannot start with a digit.

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 114 of 127

Page 116: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

13.4 Macro definition 13 PREPROCESSING

@startuml

!define SEQUENCE (S,#AAAAAA) Database Sequence!define TABLE (T,#FFAAAA) Database Table

class USER << TABLE >>class ACCOUNT << TABLE >>class UID << SEQUENCE >>USER "1" -- "*" ACCOUNTUSER -> UID@enduml

Of course, you can use the !include directive to define all your constants in a single file that youinclude in your diagram.Constant can be undefined with the !undef XXX directive.You can also specify constants within the command line, with the -D flags.

java -jar plantuml.jar -DTITLE="My title" atest1.txt

Note that the -D flag must be put after the ”-jar plantuml.jar” section.

13.4 Macro definition

You can also define macro with arguments.@startuml

!define module(x) component x <<module>>module(ABC)module(XYZ)@enduml

Macro can have several arguments.@startuml!define send(a,b,c) a->b : csend(Alice, Bob, Hello)send(Bob, Alice, ok)@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 115 of 127

Page 117: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

13.5 Adding date and time 13 PREPROCESSING

13.5 Adding date and time

You can also expand current date and time using the special variable %date%.Date format can be specified using format specified in SimpleDataFormat documentation.@startuml!define ANOTHER_DATE %date[yyyy.MM.dd 'at' HH:mm]%Title Generated %date% or ANOTHER_DATEalice -> bob@enduml

13.6 Other special variables

You can also use the following special variables:%dirpath% Path of the current file%filename% Name of the current file

13.7 Macro on several lines

You can also define macro on several lines using !definelong and !enddefinelong.@startuml!define DOUBLE(x) x x!definelong AUTHEN(x,y)x -> y : DOUBLE(hello)y -> x : ok!enddefinelong

AUTHEN(Bob,Alice)@enduml

13.8 Default values for macro parameters

It is possible to assign default values to macro parameters.@startuml!define some_macro(x, y = "some default" , z = 'another default' ) x and y and zclass foo {some_macro(Z1, Z2, Z3)some_macro(Z1, Z2)some_macro(A)}@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 116 of 127

Page 118: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

13.9 Conditions 13 PREPROCESSING

13.9 Conditions

You can use !ifdef XXX and !endif directives to have conditionnal drawings.The lines between those two directives will be included only if the constant after the !ifdef directivehas been defined before.You can also provide a !else part which will be included if the constant has not been defined.@startuml!include ArrayList.iuml@enduml

File ArrayList.iuml:

class ArrayList!ifdef SHOW_METHODSArrayList : int size()ArrayList : void clear()!endif

You can then use the !define directive to activate the conditionnal part of the diagram.@startuml!define SHOW_METHODS!include ArrayList.iuml@enduml

You can also use the !ifndef directive that includes lines if the provided constant has NOT beendefined.You can use boolean expression with parenthesis, operators and || in the test.@startuml!define SHOW_FIELDS!undef SHOW_METHODSclass foo {!ifdef SHOW_FIELDS || SHOW_METHODSThis is shown!endif!ifdef SHOW_FIELDS && SHOW_METHODSThis is NOT shown!endif}@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 117 of 127

Page 119: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

13.10 Search path 13 PREPROCESSING

13.10 Search path

You can specify the java property ”plantuml.include.path” in the command line.For example:

java -Dplantuml.include.path="c:/mydir" -jar plantuml.jar atest1.txt

Note the this -D option has to put before the -jar option. -D options after the -jar option will beused to define constants within plantuml preprocessor.

13.11 Advanced features

It is possible to append text to a macro argument using the ## syntax.@startuml!definelong COMP_TEXTGENCOMP(name)[name] << Comp >>interface Ifc << IfcType >> AS name##Ifcname##Ifc - [name]!enddefinelongCOMP_TEXTGENCOMP(dummy)@enduml

A macro can be defined by another macro.@startuml!define DOUBLE(x) x x!definelong AUTHEN(x,y)x -> y : DOUBLE(hello)y -> x : ok!enddefinelongAUTHEN(Bob,Alice)@enduml

A macro can be polymorphic with argument count.@startuml!define module(x) component x <<module>>!define module(x,y) component x as y <<module>>module(foo)module(bar, barcode)@enduml

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 118 of 127

Page 120: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

13.11 Advanced features 13 PREPROCESSING

You can use system environment variable or constant definition when using include:

!include %windir%/test1.txt!define PLANTUML_HOME /home/foo!include PLANTUML_HOME/test1.txt

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 119 of 127

Page 121: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

14 INTERNACIONALIZAÇÃO

14 Internacionalização

A linguagem PlantUML utiliza letters para definir atores, casos de uso e assim por diante. Masletters não são somente caracteres latin A-Z, elas podem ser qualquer tipo de letra de qualqueridioma.

@startumlskinparam backgroundColor #EEEBDCactorparticipant " " as Aparticipant " " as Bparticipant " " as

-> A:activate AA -> B:activate BB -> :activate

--> B:destroyB --> A:deactivate BA --> :deactivate A@enduml

14.1 Charset

The default charset used when reading the text files containing the UML text description is systemdependent. Normally, it should just be fine, but in some case, you may want to the use anothercharset. For example, with the command line:java -jar plantuml.jar -charset UTF-8 files.txt

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 120 of 127

Page 122: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

14.1 Charset 14 INTERNACIONALIZAÇÃO

Or, with the ant task:<target name="main"><plantuml dir="./src" charset="UTF-8" /></target>

Depending of your Java installation, the following charset should be available: ISO-8859-1, UTF-8,UTF-16BE, UTF-16LE, UTF-16.

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 121 of 127

Page 123: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

15 CORES

15 Cores

Aqui está uma lista de cores reconhecidas por PlantUML. Note que os nomes das cores são caseinsensitive.

AliceBlue GhostWhite NavajoWhiteAntiqueWhite GoldenRod NavyAquamarine Gold OldLaceAqua Gray OliveDrabAzure GreenYellow OliveBeige Green OrangeRedBisque HoneyDew OrangeBlack HotPink OrchidBlanchedAlmond IndianRed PaleGoldenRodBlueViolet Indigo PaleGreenBlue Ivory PaleTurquoiseBrown Khaki PaleVioletRedBurlyWood LavenderBlush PapayaWhipCadetBlue Lavender PeachPuffChartreuse LawnGreen PeruChocolate LemonChiffon PinkCoral LightBlue PlumCornflowerBlue LightCoral PowderBlueCornsilk LightCyan PurpleCrimson LightGoldenRodYellow RedCyan LightGreen RosyBrownDarkBlue LightGrey RoyalBlueDarkCyan LightPink SaddleBrownDarkGoldenRod LightSalmon SalmonDarkGray LightSeaGreen SandyBrownDarkGreen LightSkyBlue SeaGreenDarkKhaki LightSlateGray SeaShellDarkMagenta LightSteelBlue SiennaDarkOliveGreen LightYellow SilverDarkOrchid LimeGreen SkyBlueDarkRed Lime SlateBlueDarkSalmon Linen SlateGrayDarkSeaGreen Magenta SnowDarkSlateBlue Maroon SpringGreenDarkSlateGray MediumAquaMarine SteelBlueDarkTurquoise MediumBlue TanDarkViolet MediumOrchid TealDarkorange MediumPurple ThistleDeepPink MediumSeaGreen TomatoDeepSkyBlue MediumSlateBlue TurquoiseDimGray MediumSpringGreen VioletDodgerBlue MediumTurquoise WheatFireBrick MediumVioletRed WhiteSmokeFloralWhite MidnightBlue WhiteForestGreen MintCream YellowGreenFuchsia MistyRose YellowGainsboro Moccasin

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 122 of 127

Page 124: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

CONTENTS CONTENTS

Contents

1 Diagrama de Sequência 11.1 Exemplos básicos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Declarando participante . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Utilizando caracteres não letras em participantes . . . . . . . . . . . . . . . . . . . . 21.4 Mensagem para você mesmo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.5 Modificando o estilo da seta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.6 Modificando a cor da seta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.7 Numeração de sequenncia de mensagens . . . . . . . . . . . . . . . . . . . . . . . . . 41.8 Dividindo diagramas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.9 Agrupando mensagens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.10 Notas em mensagens . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.11 Algumas outras notas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.12 Modificando as formas das notas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.13 Formatação Nativa e HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.14 Divisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.15 Referência . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.16 Atraso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.17 Espaço . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131.18 Lifeline Ativação e Destruição . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131.19 Criação de participante . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141.20 Mensagens de entrada e saída . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151.21 Esteriótipos e pontos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161.22 Mais informações em títulos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171.23 Abranger participantes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181.24 Removendo rodapé . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191.25 Parâmetros para desenho . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191.26 Mudança de preenchimento . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

2 Diagrama de Caso de Uso 222.1 Casos de Uso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.2 Atores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.3 Descrição de casos de uso . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.4 Exemplo básico . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.5 Extensão . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.6 Usando notas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.7 Estereótipos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.8 Changing arrows direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.9 Splitting diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.10 Left to right direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.11 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.12 Exemplo completo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 123 of 127

Page 125: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

CONTENTS CONTENTS

3 Class Diagram 303.1 Relations between classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303.2 Label on relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313.3 Adding methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323.4 Defining visibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333.5 Abstract and Static . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343.6 Advanced class body . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353.7 Notes and stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363.8 More on notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373.9 Note on links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383.10 Abstract class and interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.11 Using non-letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403.12 Hide attributes, methods... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413.13 Hide classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.14 Use generics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.15 Specific Spot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423.16 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433.17 Packages style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433.18 Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443.19 Automatic namespace creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453.20 Lollipop interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463.21 Changing arrows direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463.22 Association classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473.23 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483.24 Skinned Stereotypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493.25 Color gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493.26 Help on layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503.27 Splitting large files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

4 Activity Diagram 534.1 Simple Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534.2 Label on arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534.3 Changing arrow direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534.4 Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544.5 More on Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554.6 Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 564.7 Long activity description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.8 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574.9 Partition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584.10 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594.11 Octagon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594.12 Complete example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 124 of 127

Page 126: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

CONTENTS CONTENTS

5 Activity Diagram (beta) 635.1 Simple Activity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635.2 Start/Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635.3 Conditional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645.4 Repeat loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655.5 While loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655.6 Parallel processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665.7 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675.8 Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675.9 Arrows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685.10 Grouping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685.11 Swimlanes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695.12 Detach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705.13 SDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715.14 Complete example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

6 Component Diagram 746.1 Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746.2 Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746.3 Basic example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746.4 Using notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756.5 Grouping Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 756.6 Changing arrows direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 776.7 Use UML2 notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 786.8 Long description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796.9 Individual colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796.10 Using Sprite in Stereotype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 796.11 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

7 State Diagram 827.1 Simple State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827.2 Composite state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 827.3 Long name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837.4 Concurrent state . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847.5 Arrow direction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 857.6 Note . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867.7 More in notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 877.8 Skinparam . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

8 Object Diagram 898.1 Definition of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898.2 Relations between objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898.3 Adding fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 898.4 Common features with class diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . 90

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 125 of 127

Page 127: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

CONTENTS CONTENTS

9 Common commands 919.1 Comentários . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 919.2 Footer and header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 919.3 Zoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 919.4 Título . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 929.5 Caption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939.6 Legenda para o diagrama . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

10 Salt 9410.1 Basic widgets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9410.2 Using grid . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9410.3 Using separator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9510.4 Tree widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9510.5 Enclosing brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9610.6 Adding tabs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9610.7 Using menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9710.8 Advanced table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

11 Creole 9911.1 Emphasized text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9911.2 List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9911.3 Escape character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10011.4 Horizontal lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10011.5 Headings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10011.6 Legacy HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10111.7 Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10211.8 Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10211.9 Special characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10311.10OpenIconic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10311.11Defining and using sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10511.12Encoding Sprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10511.13Importing Sprite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10611.14Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

12 Changing fonts and colors 10812.1 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10812.2 Nested . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10812.3 Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10912.4 Font color, name and size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11012.5 Black and White . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 126 of 127

Page 128: Desenhando UML com PlantUMLs.plantuml.com/PlantUML_Language_Reference_Guide_PT.pdfDesenhando UML com PlantUML Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017 16:33)

CONTENTS CONTENTS

13 Preprocessing 11413.1 Including files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11413.2 Including URL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11413.3 Constant definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11413.4 Macro definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11513.5 Adding date and time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11613.6 Other special variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11613.7 Macro on several lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11613.8 Default values for macro parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 11613.9 Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11713.10Search path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11813.11Advanced features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

14 Internacionalização 12014.1 Charset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

15 Cores 122

PlantUML : Guia de Referência da Linguagem (Domingo, 12 de Novembro de 2017) 127 of 127