I need to filter data on the basis of certain rules. For example, I have a list of records, and on the other hand I have a set of rules. Each rule will filter out this list. I am also maintaining a configuration file for these rules. These rules could be turn on/off through a configuration file.
For example, consider my configuration file..
[
{
"rule": "rule-1",
"class": "org.company.RuleOneFilter.class",
"isEnabled": true
},
{
"rule": "rule-2",
"class": "org.company.RuleTwoFilter.class",
"isEnabled": false
},
{
"rule": "rule-3",
"class": "org.company.RuleThreeFilter.class",
"isEnabled": true
}
]
Using this file, rules would be plugged-in or unplugged easily. I have checked the specification of Chain Of Responsibility but still confused whether to go for it or not! Can someone suggest me an appropriate design pattern to implement this? Or if there's any framework to fulfill this need?
Aucun commentaire:
Enregistrer un commentaire