Say I have this:
public class Foo {
private String value;
}
And I also have this:
public class Bar extends Foo {
private String anotherValue;
}
I want this to be able to bind to an object Bar:
<foo>
<value>smang</value>
<anotherValue>wratz</anotherValue>
</foo>
I can’t check right now, but if I change the name @XmlRootNode Barto 'foo' and just pass it Bar.classto the JAXB marshaller, will this work? Do I need to do something smarter?
source
share