i have a class X with maybe 100 String in it and i want to do a function that mock an object of this class for all the setters which begins by "setTop".
For the moment i did this :
public void setFtoMethods(Class aClass){
Methods[] methods = aClass.getMethods();
for(Method method : methods){
if(method.getName().startsWith("setTop")){
method.invoke ....
}
}
}
And i don't know how to do now and i'm not pretty sure i can fill all these setters like that. In my environment i can't use Frameworks and i'm in Java 6. I didn't found on stackoverflow this exact question before. Can someone help me for that please ?
Thanks.
Aucun commentaire:
Enregistrer un commentaire