decor Wrapper interface
Vladimir Bauer
6 years ago
| 77 | 77 |
noPop bool
|
| 78 | 78 |
aDecorators []decor.Decorator
|
| 79 | 79 |
pDecorators []decor.Decorator
|
| 80 | |
mDecorators []decor.Decorator
|
| 81 | 80 |
amountReceivers []decor.AmountReceiver
|
| 82 | 81 |
shutdownListeners []decor.ShutdownListener
|
| 83 | 82 |
averageAdjusters []decor.AverageAdjuster
|
|
| 195 | 194 |
for _, decorators := range [...][]decor.Decorator{
|
| 196 | 195 |
s.pDecorators,
|
| 197 | 196 |
s.aDecorators,
|
| 198 | |
s.mDecorators,
|
| 199 | 197 |
} {
|
| 200 | 198 |
for _, d := range decorators {
|
| 201 | |
cb(d)
|
|
199 |
cb(extractBaseDecorator(d))
|
| 202 | 200 |
}
|
| 203 | 201 |
}
|
| 204 | 202 |
}
|
|
| 461 | 459 |
Current: s.current,
|
| 462 | 460 |
}
|
| 463 | 461 |
}
|
|
462 |
|
|
463 |
func extractBaseDecorator(d decor.Decorator) decor.Decorator {
|
|
464 |
if d, ok := d.(decor.Wrapper); ok {
|
|
465 |
return extractBaseDecorator(d.Base())
|
|
466 |
}
|
|
467 |
return d
|
|
468 |
}
|
| 71 | 71 |
type Configurator interface {
|
| 72 | 72 |
GetConf() WC
|
| 73 | 73 |
SetConf(*WC)
|
|
74 |
}
|
|
75 |
|
|
76 |
// Wrapper interface.
|
|
77 |
// If you're implementing custom Decorator by wrapping a built-in one,
|
|
78 |
// it is necessary to implement this interface to retain functionality
|
|
79 |
// of built-in Decorator.
|
|
80 |
type Wrapper interface {
|
|
81 |
Base() Decorator
|
| 74 | 82 |
}
|
| 75 | 83 |
|
| 76 | 84 |
// AmountReceiver interface.
|