Imagine a simple Controller
(as in process control) interface. I have some concrete classes, say PIDController
, that implement it. I also have some decorator classes that extend these classes somehow, say ITAETuningDecorator
.
Now imagine that a FloodGate
class has a private Controller
field. I would like, from the outside and at runtime, to attach to the Controller
in FloodGate
an ITAETuningDecorator
. How can I do it? I have no access to the field from the outside and obviously the decorator needs a reference to the original controller to be built.
FloodGate.DecorateController(ControllerDecoratorFactory factory)
method which would do something like{ this.controller = factory.Create(this.controller); }
?