title: Java - Using Ant to automatically generate boilerplate code
body: <p><strong>Intro:</strong>
  I'm asking this before I try, fail and get frustrated as I have 0 experience with Apache Ant. A simple 'yes this will work' may suffice, or if it won't please tell me what will.</p>
  
  <p><strong>Situation:</strong>
  I'm working on a project that uses JavaFX to create a GUI. JavaFX relies on Java Bean-like objects that require a lot of boilerplate code for it's properties. For example, all functionality I want to have is a <em>String</em> called <em>name</em> with default value <em>"Unnamed"</em>, or in a minimal Java syntax:</p>
  
  <pre><code>String name = "Unnamed";
  </code></pre>
  
  <p>In JavaFX the minimum amount of code increases a lot to give the same functionality (where functionality in this case means to me that I can set and get a certain variable to use in my program):</p>
  
  <pre><code>private StringProperty name = new StringProperty("Unnamed");
  public final String getName() { return name.get(); }
  public final void setName(String value) { name.set(value); }
  </code></pre>
  
  <p><strong>Question:</strong> Can I use Ant to generate this boilerplate code? </p>
  
  <p>It seems possible to make Ant scripts that function as (Java) preprocessors. For instance by using the regex replace (<a href="https://ant.apache.org/manual/Tasks/replaceregexp.html" rel="nofollow">https://ant.apache.org/manual/Tasks/replaceregexp.html</a>) functions. I'm thinking of lines of code similar to this in my code, which then will be auto-replaced:</p>
  
  <pre><code>&lt;TagToSignifyReplaceableLine&gt; StringProperty person "Unnamed"
  </code></pre>
  
  <p><strong>Final remark:</strong> As I've said before I have never used Ant before, so I want to check with you if 1) this can be done and 2) if this is a good way to do it or if there are better ways.</p>
  
  <p>Thanks!</p>