In java reflection, we generally try to get fields value at runtime by its attribute name. But considering performance impact its not recomended to use reflection.
But in this case can we use groovy objects which allows the retrival of value by name of attribute For example:
Class Person { String name }
Class mainApp { public static void main(String[] args) { Person p = new Person(); p.”name”=“jonh”;}}
Will this have same performance as of reflection?
Aucun commentaire:
Enregistrer un commentaire