I've got a class - let's call it SuperClass
that contains hundreds of attributes that are objects of the same class. I'd need to call a getter getProperties()
to every single of these attributes. It's quite clear that reflection
would come in handy in this situation.
I'm able to get name and class of every single of these attributes. Could anybody tell me, how to adjust my code to by able to call .getProperties()
method to all of these attributes? Thanks in advance.
for (Field field : SuperClass.getClass().getDeclaredFields()) {
System.out.println(field.getName());
}
Aucun commentaire:
Enregistrer un commentaire