I have a problem statement in which there are certain set of actions (A1,A2,A3,...,An). Based upon an event type (E1,E2,E3...,Em), different set of actions can be applied.
For example:
Event E1 -> A1, A3, A5
Event E2 -> A2, A5, A7
Also, more actions can be added into action set. Hence, my code should be open for extension.
I thought of applying decorator pattern, but it seems like in decorator pattern we can attach additional responsibility(actions) and return the same object. In my case it is possible that not all actions are returning the same object and might be doing/triggering a different process.
Is there any design pattern in Java which handles this scenario?
Aucun commentaire:
Enregistrer un commentaire