PlantUML este un instrument open-source care permite utilizatorilor să creeze diagrame din simple descrieri în text simplu.
Blocuri de bază de diagrame
@startuml
User -> Service : Authenticate
Service --> User : Token
@enduml
Diagrame de clase (Class Diagrams)
Atribute de clasă și vizibilitate
@startuml
class BankAccount {
+String owner
#Integer accountNumber
-Decimal balance
~String branchCode
+deposit(amount : Decimal) : void
-calculateInterest() : Decimal
{static} String bankName
{abstract} getAccountType() : String
}
@enduml
| Modificator | Vizibilitate |
|---|---|
+ |
Public |
- |
Privat (Private) |
# |
Protejat (Protected) |
~ |
Privat pentru pachet (Package Private) |
Relații între clase (Class Relationships)
@startuml
Animal <|-- Dog : Extension / Inheritance
Car *-- Engine : Composition
College o-- Student : Aggregation
Driver ..> Car : Dependency
Interface <|.. Impl : Implementation (Dotted)
@enduml
| Sintaxă | Relație | Semnificație |
|---|---|---|
| `< | --` | Generalizare / Moștenire |
*-- |
Compoziție | Copilul nu poate exista fără părinte |
o-- |
Agregare | Copilul poate exista independent |
| `< | ..` | Realizare |
..> |
Dependență | Utilizare tranzitorie |
Note și adnotări
@startuml
class Customer
note left of Customer : Customer identity record
note "Floating standalone note" as N1
@enduml
Diagrame de activitate (Activity Diagrams)
@startuml
start
:Receive Payment;
if (Verified?) then (yes)
:Fulfill Order;
:Send Email;
else (no)
:Notify Customer;
endif
stop
@enduml