#590 Add explanation to Decorator pattern

This commit is contained in:
Ilkka Seppälä
2017-09-02 23:10:39 +03:00
parent 6c9e005a79
commit 9d2f0c6c71
8 changed files with 103 additions and 173 deletions

View File

@ -1,38 +0,0 @@
@startuml
package com.iluwatar.decorator {
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
}
class ClubbedTroll {
- LOGGER : Logger {static}
+ ClubbedTroll(decorated : Troll)
+ attack()
+ getAttackPower() : int
}
class SimpleTroll {
- LOGGER : Logger {static}
+ SimpleTroll()
+ attack()
+ fleeBattle()
+ getAttackPower() : int
}
interface Troll {
+ attack() {abstract}
+ fleeBattle() {abstract}
+ getAttackPower() : int {abstract}
}
class TrollDecorator {
- decorated : Troll
+ TrollDecorator(decorated : Troll)
+ attack()
+ fleeBattle()
+ getAttackPower() : int
}
}
TrollDecorator --> "-decorated" Troll
ClubbedTroll --|> TrollDecorator
SimpleTroll ..|> Troll
TrollDecorator ..|> Troll
@enduml