title: How to generate code dynamically with annotations at build time in Java?
body: <p>I'm looking for a solution for generating code. I have googled, searched on SO and some blogs but I didn't find a good solution.</p>
  
  <p>I'd like to put an annotation on my class and at compilation time, some methods and properties would be automatically added to the class.</p>
  
  <p>Key points of the solution I'm looking for :</p>
  
  <ul>
  <li>Generated code customizable (MANDATORY)</li>
  <li>No external tool like <code>apt</code> have to be called (MANDATORY)</li>
  <li>JDK only, no third-party framework (<s>MANDATORY</s> OPTIONAL)</li>
  <li>Annotation name customizable (OPTIONAL)</li>
  </ul>
  
  <p>For example :</p>
  
  <pre><code>@Aliasable
  public class MyClass {
  //Some properties
  
  // Contructor ...
  
  // Some methods
  }
  </code></pre>
  
  <p>My class would look like this after compilation :</p>
  
  <pre><code>public class MyClass {
     //Some properties
     private String alias;
  
     // Contructor ...
  
     // Some methods
     public String getAlias() {
        return alias;
     }
  
     public void setAlias(String alias) {
        this.alias=alias;
     }
  }
  </code></pre>
  
  <p><strong>EDIT:</strong><br>
  Finally, I turned my third requirement from MANDATORY to OPTIONAL and choosed <a href="http://projectlombok.org/" rel="noreferrer">project Lombok</a> (easy integration with Maven and Eclipse, virtually no work to do 
   for using it).</p>