[UML]PUML 사용법

dkdiek·2024년 4월 23일

UML

목록 보기
1/1

-- 사용 방법

  • IntelliJ 플러그인 설치
  • .puml 확장자 생성

-- 표현 방법

+: public
-: private
#: protected
~: default 또는 package-private

생성자 표기 예시(변수명:타입)
+ CoffeeDecorator(coffee: Coffee)

-- 주석

/''/

-- 메모

bottom: 메모 위치
Americano: 클래스

note bottom of Americano
    ConcreteComponent
end note

-- 작성 예시

@startuml
/'------------------------'/
interface Coffee {
    + getCoffee(): String
    + price(): int
}
note right of Coffee
    Component
end note
/'------------------------'/
class Americano {
    + getCoffee(): String
    + price(): int
}
note bottom of Americano
    ConcreteComponent
end note
/'------------------------'/
class CoffeeDecorator {
    - coffee: Coffee
    /'UML 생성자 표기할 때 변수명:타입 순'/
    + CoffeeDecorator(coffee: Coffee)
    + getCoffee(): String
    + price(): int
}
note top of CoffeeDecorator
    Decorator
end note
/'------------------------'/
class ShotDecorator {
    + ShotDecorator(coffee: Coffee)
    + getCoffee(): String
    + price(): int
}
note bottom of ShotDecorator
    ConcreteDecorator
end note
/'------------------------'/
class SugarDecorator {
    + SugarDecorator(coffee: Coffee)
    + getCoffee(): String
    + price(): int
}
note bottom of SugarDecorator
    ConcreteDecorator
end note
/'------------------------'/
Coffee <|.. Americano
Coffee <|.. CoffeeDecorator
CoffeeDecorator <|-- ShotDecorator
CoffeeDecorator <|-- SugarDecorator

@enduml

0개의 댓글