+: 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
