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