I have two jaxb-annotated classes generated from jax-ws wsimport. They are "top-level" classes, each referenced from different jax-ws methods.
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Level0MessageType", propOrder = {
"header",
"payload"
})
public class Level0MessageType {
@XmlElement(name = "Header", required = true)
protected MessageHeaderType header;
@XmlElement(name = "Payload", required = true)
protected Level0PayloadType payload;
... etc ..
}
and
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Level1MessageType", propOrder = {
"header",
"payload"
})
public class Level1MessageType {
@XmlElement(name = "Header", required = true)
protected MessageHeaderType header;
@XmlElement(name = "Payload", required = true)
protected Level1PayloadType payload;
... etc.
}
They both contain a common "header" element. I need to access that element from the parent object w/o knowing the parent concrete type. I could define an interface and then have both Level0MessageType and Level1MessageType implement a method to return the header, but that means that whenever wsimport re-generates my java classes, I would lose the changed code. Any better solution?
Thanks.