title: Generating getters/setters in Java (again)
body: <p>I'm considering the approaches to write</p>
  
  <pre>
  <code>
  class MyClass {
    @Get
    @Set
    protected int aValue;
  }
  </code>
  </pre>
  
  <p>and then, automatically, generate get_aValue() and set_AValue() methods for the class.</p>
  
  <p>I've found these possibilities:</p>
  
  <p>1a) At compile time. Use an annotation processor for separately processing  MyClass.java, then write a new MyClass.java, and finally use this latter (substituting the original) with the rest of .java</p>
  
  <p>1b) At compile time. Use an annotation processor to generate a MyClassGenerated.java file with a new class (with the get/set methods) being this one a sub-class of the original MyClass. </p>
  
  <p>2) At run time. Use java.lang.instrument and an external tool (like BCEL) to weave new code in MyClass.class.</p>
  
  <p><b>
  Well, the questions are: considering that as far as possible I don't want to use third party libraries (like the lombok project or BCEL)</p>
  
  <p>a) Am I missing any other approach?</p>
  
  <p>b) Which approach would you use?
  </b></p>
  
  <p>I guess I will use 1a) because</p>
  
  <p>1b) is not clean (the rest of the program should use MyClassGeneradted instead of the original MyClass, although perhaps it's only a matter of names)</p>
  
  <p>2) is really difficult (for me, at least).</p>