Can I reuse decorators?
I have a ClientDecorator
to decorate an entity that has a reference of a client, this decorator gets the client on database on call getClient (before it gets decorated, this method returns the clientId, after being decorated, it returns an instance of Client).
Okay, but, I've some other entities that can be decorated with the same decorator, for example, I have another table named questions
, this table has a reference pointing to a client that has asked a question, and I have another table named schedules
, that has a reference of a client.
By the way, I can decorate question
and schedule
with ClientDecorator
.
But, I have an QuestionDecorator
too; this guy decorates an Answer
, etc.
How I can do this abstraction, so I can reuse decorators whenever I want?
I've tried to create ClientDecorable
, QuestionDecorable
interfaces, but have made no progress.