빠른 참조

PlantUML 치트시트

PlantUML 빠른 참조 가이드: 클래스 다이어그램 구문, 접근 제어자, 상속, 컴포지션, 메모 및 액티비티 워크플로우 정리.

· 게시일

PlantUML은 간단한 일반 텍스트 언어 설명으로 다이어그램을 생성할 수 있는 오픈 소스 도구입니다.

기본 다이어그램 블록

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

클래스 다이어그램 (Class Diagrams)

클래스 속성 및 접근 제어자 (Visibility)

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

  +deposit(amount : Decimal) : void
  -calculateInterest() : Decimal
  {static} String bankName
  {abstract} getAccountType() : String
}
@enduml
제어자 가시성 (Visibility)
+ 공개 (Public)
- 비공개 (Private)
# 보호됨 (Protected)
~ 패키지 전용 (Package Private)

클래스 관계 (Class Relationships)

@startuml
Animal <|-- Dog      : Extension / Inheritance
Car *-- Engine       : Composition
College o-- Student  : Aggregation
Driver ..> Car       : Dependency
Interface <|.. Impl  : Implementation (Dotted)
@enduml
구문 관계 의미
`< --` 일반화 / 상속 (Generalization / Inheritance)
*-- 컴포지션 (Composition) 부모 없이 자식이 존재할 수 없음
o-- 집약 (Aggregation) 자식이 독립적으로 존재 가능함
`< ..` 실체화 (Realization)
..> 의존 (Dependency) 일시적 사용

메모 및 주석 (Notes & Annotations)

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

액티비티 다이어그램 (Activity Diagrams)

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

참고 자료

관련 주제