title: Generate constants for class attributes with maven?
body: <p>i have a small code generation question.
  I have a EJB3 backend that serves DTO objects to a frontend. The frontend uses a configurable binding procedure to map the attributes of the DTO to their forms.
  At the moment they are doing it by specifing the attributes as strings in ther configuration. The binding implementation uses reflection to acces the attributes.
  Sounds nice but the problem is, each time we change an attribute name in a DTO, this will not lead to a compile error in the frontend because they have just strings.</p>
  
  <p>I'm now looking for a way to create a string constant for each attribute of the class that can be used by the frontend to map the attributes to their forms so that they get compile errors if i made changes in the dto attributes.</p>
  
  <p><strong>Example how it is:</strong></p>
  
  <pre><code>public class CarDTO {
  
      private String vendor;
      private String name;
  
  
      public String getVendor() {}
      public String getName() {}
      [..]    
  }
  </code></pre>
  
  <p><strong>And how it should be:</strong></p>
  
  <pre><code>public class CarDTO {
  
      public static final String VENDOR = "vendor";
      public static final String NAME = "name";
  
      private String vendor;
      private String name;
  
  
      public String getVendor() {}
      public String getName() {}
      [..]    
  }
  </code></pre>
  
  <p>I was looking for a maven plugin that is capable of this but without success. Is there any one who nows a tool which can do things like that?</p>
  
  <p>Thanks in advance</p>
  
  <p>martin</p>