let’s say that we have a class to which occasionally are added new checks and you end with something like describe below:
class CheckList{
check1(){
//do something
}
check1(){
//do something
}
//...
checkN(){
//do something
}
}
and you want to call all the checks in a straightforward way
I have considered the following options:
- use reflexion to get the methods, iterate and executing them
- use a list containing the check names, iterate and execute them
- use annotations to load, populate a map and go to 2
what I want to avoid is the need modify other classes each time that a new check is added.
is there a design pattern/recipe known to achieve such thing?
Aucun commentaire:
Enregistrer un commentaire