title: How to get the name of a property as string?
body: <p>I have a class <code>Car</code> that has a <code>Field</code> named <code>trunk</code>. How can I retrieve that name only with the property that is assigned to it and without any fixed <code>String</code>.
  Something working like this fiction would be great:</p>
  
  <pre><code>System.out.println(new Car().getTrunk().getField().getName());
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>trunk
  </code></pre>
  
  <p>I don't want to use a fixed <code>String</code> to retrieve the <code>Field</code> and it's name because that would not refactor well. If I decide to rename from <code>trunk</code> to <code>boot</code> I want this to be handled completely by my IDE's refactoring tool.</p>
  
  <p>UPDATE <code>Car</code> class:</p>
  
  <pre><code>public class Car{
      String trunk;
      // getters + setters
  }
  </code></pre>
  
  <p><strong>BACKGROUND:</strong><br>
  I want to use <a href="http://www.primefaces.org/showcase/ui/datatableDynamicColumns.jsf" rel="nofollow">Primefaces' Dynamic Columns</a> for a CRUD-UI for several entities which uses a <code>columnTemplate</code> containig the names of the <code>Field</code>s/properties to be evaluated by <code>Expression Language</code>.</p>