lundi 19 septembre 2016

Java reflection: getting list of declared variables within same class? [duplicate]

This question already has an answer here:

Is it possible to get a list of declared variables within the same class? To be very honest, I looked at nearly every post about reflection I could find. There is too much going on though, I just need a simple example. I know reflection api has getDeclaredField() method.

What I am trying to achieve is something like this:

for (var : variablesList) {
  var = null;
}

The reason I need this is because I want to set variable.getStyleClass().add(variableName); for every variable there is.





Aucun commentaire:

Enregistrer un commentaire