title: Generate java code in Eclipse?
body: <p>Does anyone know what approach one can take to automatically generate Java source code, from for example an xml or json file, in eclipse?</p>
  
  <p>One great example of what I am thinking of doing is what Google Android sdk does: they have an R class generated automatically from the <a href="http://developer.android.com/guide/topics/resources/available-resources.html" rel="noreferrer">resources</a>.</p>
  
  <p>Every time a resource file is saved in Eclipse R class is automatically regenerated.</p>
  
  <p>UPDATE: Example:
  In the text (xml or json file) I have the following:</p>
  
  <pre><code> &lt;tags&gt;
       &lt;tag id="ALPHA"&gt;
           &lt;description&gt;The first alpha tag.&lt;/description&gt;
           &lt;value&gt;231232&lt;/value&gt;
       &lt;/tag&gt;
       &lt;tag id="BETA"&gt;
           &lt;description&gt;This is the beta tag.&lt;/description&gt;
           &lt;value&gt;231232&lt;/value&gt;
       &lt;/tag&gt;
  </code></pre>
  
  <p>Then in my generated java class, say R I would have something like:</p>
  
  <pre><code>R.tags.ids.ALPHA //refers to an enum value for example
  R.tags.values.ALPHA //refers to final int with avlue 231232
  R.tags.descriptions.ALPHA //refers to the String with description
  </code></pre>
  
  <p>Thanks!</p>