This question already has an answer here:
- Loop over all fields in a Java class 3 answers
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