title: @XmlSeeAlso alternative
body: <p>I have the following:</p>
  
  <pre><code>class A{
      @XmlElement
      String name;
  
      //getters and setters
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>class B extends A{
      @XmlElement
      String height;
  
      //getters and setters
  }
  </code></pre>
  
  <p>finally I have</p>
  
  <pre><code>@XmlRootElement
  class P{
      @XmlElement
      List&lt;A&gt; things;
  
      //getters and setters
  }
  </code></pre>
  
  <p>If I do</p>
  
  <pre><code>List&lt;A&gt; l = new ArrayList&lt;A&gt;();
  l.add(new B('hello', 20)) //Add new B with height of 20 and name hello
  
  P p = new P();
  p.setThings(l); //Set things to list of B's.
  </code></pre>
  
  <p>and marshal P, I only get the  field as part of things and not height.</p>
  
  <p>I know that I can add @XmlSeeAlso(B.class) in A and it will all work.</p>
  
  <p>But the issue is that I don't know all extended classes other than B, as A may be extended on runtime.</p>
  
  <p>How do I dynamically define @XmlSeeAlso on runtime?</p>