title: How to apply polymorphism to xml deserialization?
body: <p>I have two types of xml:</p>
  
  <pre><code>&lt;exec&gt;&lt;cmd&gt;STATISTIC&lt;/cmd&gt;&lt;param&gt;&lt;/param&gt;&lt;/exec&gt;
  
  &lt;exec&gt;&lt;cmd&gt;FILE_TO_CLIENT&lt;/cmd&gt;&lt;param&gt;&lt;filePath&gt;"/opt/tst"&lt;/filePath&gt;&lt;msg&gt;"ls- la"&lt;/msg&gt;&lt;/param&gt;&lt;/exec&gt;
  </code></pre>
  
  <p>I need to pass them to function that  might return two types of class object</p>
  
  <pre><code>class Statistic    {
  }
  
  class FileToClient
  {
    String msg;
    String filePath;
  }
  </code></pre>
  
  <p>In case the message is of type <code>statistic</code> - no fields are required. In case it is <code>file_to_client</code> , <code>msg</code> and <code>filePath</code> fields should be filled from xml.</p>
  
  <p>How should I organize my class hierarchy so that the deserializer function could return both type of objects?</p>