Let's say I have this:
public class Foo {
private String value;
// <snip> getters and setters, constructors etc
}
And I also have this:
public class Bar extends Foo {
private String anotherValue;
// <snip> getters and setters, constructors etc
}
I want to be able to marshall this to a Bar
object:
<foo>
<value>smang</value>
<anotherValue>wratz</anotherValue>
</foo>
I'm not in a position to check right now, but if I change the @XmlRootNode
name of Bar
to 'foo' and only pass Bar.class
to the JAXB marshaller will that work? Do I have to do anything more clever than that?