EN: The base Decorator class follows the same interface as the other components. The primary purpose of this class is to define the wrapping interface for all concrete decorators. The default implementation of the wrapping code might include a field for storing a wrapped component a
| 38 | |
| 39 | |
| 40 | class Decorator(Component): |
| 41 | """ |
| 42 | EN: The base Decorator class follows the same interface as the other |
| 43 | components. The primary purpose of this class is to define the wrapping |
| 44 | interface for all concrete decorators. The default implementation of the |
| 45 | wrapping code might include a field for storing a wrapped component and the |
| 46 | means to initialize it. |
| 47 | |
| 48 | RU: Базовый класс Декоратора следует тому же интерфейсу, что и другие |
| 49 | компоненты. Основная цель этого класса - определить интерфейс обёртки для |
| 50 | всех конкретных декораторов. Реализация кода обёртки по умолчанию может |
| 51 | включать в себя поле для хранения завёрнутого компонента и средства его |
| 52 | инициализации. |
| 53 | """ |
| 54 | |
| 55 | _component: Component = None |
| 56 | |
| 57 | def __init__(self, component: Component) -> None: |
| 58 | self._component = component |
| 59 | |
| 60 | @property |
| 61 | def component(self) -> Component: |
| 62 | """ |
| 63 | EN: The Decorator delegates all work to the wrapped component. |
| 64 | |
| 65 | RU: Декоратор делегирует всю работу обёрнутому компоненту. |
| 66 | """ |
| 67 | |
| 68 | return self._component |
| 69 | |
| 70 | def operation(self) -> str: |
| 71 | return self._component.operation() |
| 72 | |
| 73 | |
| 74 | class ConcreteDecoratorA(Decorator): |
nothing calls this directly
no outgoing calls
no test coverage detected