title: Create JTree of objects and their declared fields with reflection
body: <p>I need dynamic JTree where nodes would be objects and when node is expanded i would use reflection to get the declared fields. All non - primitive fields would again be nodes, and so on, recursively.</p>
  
  <p>So here is short desc of my TreeNode class:</p>
  
  <pre><code> public TreeNode(Object o){
  
          this.name = o.getClass().getSimpleName();
          this.treeobjectclass = o.getClass();
          this.isbranch = isBranchObject();
          this.properties = initializePropertiesMap();
          this.children = //here i will get children with getDeclared fields and 
                         //instantiate new TreeNode for nonprimitive ones
  
  }
  </code></pre>
  
  <p>Questions: </p>
  
  <ol>
  <li><p>When doing recursive instantiation through children, how can I avoid a problem when I run into one of children classes whose constructor asks for arguments? </p></li>
  <li><p>Should I maybe be passing the Class parameter instead of Object into constructor?</p></li>
  <li>If i do this, what if later i need to get the object of this class, and i try it with class.getConstructor - again, I dont have parameters.</li>
  </ol>
  
  <p>How to get out of this cursed loop ? Im totally new with reflection. Any examples of similar work?</p>
  
  <p>Thank you</p>