title: Java - Exclude superclass fields from reflection
body: <p>I'm using this code to get all fields associated with an Object. The Object in question has three super classes, and other classes extend from this object.</p>
  
  <pre><code>for (Field f : this.getClass().getFields()){
      try{
          fieldName = f.getName();
          fieldType = f.getType().toString();
          //Do more stuf
      }
  </code></pre>
  
  <p>I do not want to get the fields associated with the super classes, but I want all fields in the current class and all those that may extend from it. </p>
  
  <p>How do I filter out which fields are the ones I need?</p>