Szybka pomoc

Ściągawka z PlantUML

Skrócony przewodnik po PlantUML: składnia diagramów klas, modyfikatory widoczności, dziedziczenie, kompozycja, notatki i diagramy aktywności.

· Opublikowano

PlantUML to narzędzie open source umożliwiające tworzenie diagramów na podstawie prostych opisów tekstowych.

Podstawowe bloki diagramów

@startuml
User -> Service : Authenticate
Service --> User : Token
@enduml

Diagramy klas (Class Diagrams)

Atrybuty klas i widoczność

@startuml
class BankAccount {
  +String owner
  #Integer accountNumber
  -Decimal balance
  ~String branchCode

  +deposit(amount : Decimal) : void
  -calculateInterest() : Decimal
  {static} String bankName
  {abstract} getAccountType() : String
}
@enduml
Modyfikator Widoczność
+ Publiczny (Public)
- Prywatny (Private)
# Chroniony (Protected)
~ Pakietowy (Package Private)

Relacje między klasami (Class Relationships)

@startuml
Animal <|-- Dog      : Extension / Inheritance
Car *-- Engine       : Composition
College o-- Student  : Aggregation
Driver ..> Car       : Dependency
Interface <|.. Impl  : Implementation (Dotted)
@enduml
Składnia Relacja Znaczenie
`< --` Generalizacja / Dziedziczenie
*-- Kompozycja Obiekt podrzędny nie może istnieć bez nadrzędnego
o-- Agregacja Obiekt podrzędny może istnieć niezależnie
`< ..` Realizacja
..> Zależność Użycie przejściowe

Notatki i adnotacje

@startuml
class Customer
note left of Customer : Customer identity record
note "Floating standalone note" as N1
@enduml

Diagramy aktywności (Activity Diagrams)

@startuml
start
:Receive Payment;
if (Verified?) then (yes)
  :Fulfill Order;
  :Send Email;
else (no)
  :Notify Customer;
endif
stop
@enduml

Źródła

Powiązane tematy