I have a structure like
public class Grandpa...
public class Father extends Grandpa...
public class Son extends Father...
I want to marshall it to file with propOrder annotation.
So i can use @XmlTransient on Grandpa and set propOrder on Father class, but How can i apply propOrder to all 3 classes?
As i understand '@XmlTransient'-approach is only for one super class, and one child class?
When you specify @XmlTransient
on a class as far as JAXB is concerned you remove it from the inheritance hierarchy and its properties are considered part of its children. This means if you mark Father
as transient you can include its properties in the propOrder
for Son
. If you mark Grandpa
and Father
as transient then you could include the properties from both classes in the propOrder
for Son
.
Without @XmlTransient
you can still use propOrder
, but in that propOrder
you can only specify the properties that correspond to that class. This corresponds to the ordering of elements that occurs with extended complex types, inherited properties appear first.
For More Information
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With