jeudi 10 septembre 2020

Java reflections: Set field value best practice

Assuming that there is no special logic in a field set method, What would be the best practice to set field's value using reflections? would it be

  field.set(obj, value);

or

  method = obj.getClass().getMethod("setSomething", parameter.class);
  method.invoke(obj, argument);




Aucun commentaire:

Enregistrer un commentaire