Static Class Structure
Client
Component interface.
Component
Component1 and Decorator
objects.
Component1
Decorator
Component object
(component).
component.operation()).
Decorator1,Decorator2,…
addBehavior())
to be performed before and/or after forwarding a request.
Dynamic Object Collaboration
Client object
works through two decorators
that add responsibilities to a
Component1 object.
Client calls
operation()
on the
Decorator1 object.
Decorator1
forwards the request to the
Decorator2 object.
Decorator2
forwards the request to the
Component1 object.
Component1 performs the request
and returns to Decorator2.
Decorator2 performs
additional functionality
(by calling addBehavior()
on itself) and returns to Decorator1.
Decorator1 performs
additional functionality
and returns to the Client.