title: Is there an abstract way to get all properties of an entity in java?
body: <p>I am using Netbeans 7.2.1 on windows 7.</p>
  
  <p>I am trying to get all the properties of an entity and store them in a String array. I want to do this in the most general way I can think of, so a method like the one in jCSV:</p>
  
  <pre><code>public void writeAll(List&lt;E&gt; data) throws IOException {
      for (E e : data) {
          write(e);
      }
  }
  </code></pre>
  
  <p>You can find that package here: <a href="https://code.google.com/p/jcsv/" rel="nofollow noreferrer">https://code.google.com/p/jcsv/</a></p>
  
  <pre><code>public String[] getProperties( E e ){
  
      String [] properties = new String[ e.numberOfProperties ];
      int i = -1;
  
      for ( P p : e ) {
  
          i += 1;
          properties[i] = p.toString(); // OR properties[i] = e.getProperty[i].toString();
  
      }
  
      return properties;
  }
  </code></pre>
  
  <p>I feel like there should be some way of doing this with <a href="http://docs.oracle.com/javase/6/docs/api/java/util/Properties.html" rel="nofollow noreferrer">the Properties class</a> but I can't figure out a way to use it to get properties <em>from</em> an entity. I think it's just something simple, but I can't see where. </p>