This question already has an answer here:
I have a normal java bean class, like so
class MyBean {
private String name;
public void setName(String name){
//perfome some checks here
this.name = name;
}
}
Now, the setName is invoked dynamically at runtime via reflection, like so
field.set(target, value);
The value is set properly, but rather what i want is a way to invoke setName, having only MyBean instance and name field as knowns. Thanks
Aucun commentaire:
Enregistrer un commentaire