title: Is there any tool or library that converts YAML or XML files into Java code?
body: <p>Is there a tool or library that converts object serialized into YAML or XML file into Java code creating that object?</p>
  
  <p>From technical point of view, I see no difficulties here. Both Yaml and XStream (or other similar tools) needs to find Java class name via reflection, find constructor, invoke it, then find setters and invoke them. Reflection invokes can be replaced by Java code generation that is doing the same. It requires a bit work, however.</p>
  
  <p>Does such tool exist? Or maybe someone is developing it and want to share it with public?</p>
  
  <p>P.S. Any library with ability to convert given Java object into Java code would fullfill my needs. </p>
  
  <p><strong>clarification</strong></p>
  
  <p>I expect the tool to convert example YAML:</p>
  
  <pre><code>--- !pl.example.Contact
  name: Nathan Sweet
  age: 28
  </code></pre>
  
  <p>Or XML:</p>
  
  <pre><code>&lt;contact&gt;
    &lt;name&gt;Nathan Sweet&lt;/name&gt;
    &lt;age&gt;28&lt;/age&gt;
  &lt;/contact&gt;
  </code></pre>
  
  <p>into the code:</p>
  
  <pre><code>pl.example.Contact contact = new pl.example.Contact();
  contact.setName("Nathan Sweet");
  contact.setAge(28);
  </code></pre>