I have the following:
class A{ @XmlElement String name;
and
class B extends A{ @XmlElement String height;
Finally i
@XmlRootElement class P{ @XmlElement List<A> things;
If i do
List<A> l = new ArrayList<A>(); 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.
and Marshal P, I only get the field as part of things, not the height.
I know that I can add @XmlSeeAlso (B.class) to A and everything will work.
But the problem is that I do not know all the extended classes other than B, since A can be extended at runtime.
How do I dynamically detect @XmlSeeAlso at runtime?
source share