I have a Java class that has a number of Fields
.
I would like to Loop over al lthe fields and do something for the one's that are null.
For example if my class is:
public class ClassWithStuff {
public int inty;
public stringy;
public Stuff;
//many more fields
}
In another location, I'd make a ClassWithStuff
object and I would like to go though all the fields in the class. Kind of like this:
for (int i = 0; i < ClassWithStuff.getFields().size(); i++) {
//do stuff with each one
}
Is there any way for me to achieve this?