Hi again,
Simpler problems now, although I'm pretty confident this is a bug of
some sort. In short - if I have a subclass that wants to change the
propOrder I'm finding that either I cant do it (if I include the
superclasses properties I get a "Property surname appears in
@XmlType.propOrder, but no such property exists" error message), or if
I override the methods to simply call super (so as to add them to the
child class) I get doubling up. Here's my code:
@XmlRootElement
public class Name
{
private String givenName;
private String surname;
public String getGivenName()
{
return givenName;
}
public void setGivenName(String givenName)
{
this.givenName = givenName;
}
public String getSurname()
{
return surname;
}
public void setSurname(String surname)
{
this.surname = surname;
}
}
@XmlType(propOrder={
"title",
"givenName",
"middleName",
"surname"
})
@XmlRootElement
public class FullName extends Name
{
private String title;
private String middleName;
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getMiddleName()
{
return middleName;
}
public void setMiddleName(String middleName)
{
this.middleName = middleName;
}
// --------------------------------------------------------------------------------------------
//
public String getGivenName()
{
return super.getGivenName();
}
public void setGivenName(String givenName)
{
super.setGivenName(givenName);
}
public String getSurname()
{
return super.getSurname();
}
public void setSurname(String surname)
{
super.setSurname(surname);
}
}
Like I said above, removing the get/set givenName/surname methods from
FullName I get this:
com.sun.xml.bind.v2.runtime.IllegalAnnotationException: Property
surname appears in @XmlType.propOrder, but no such property exists
this problem is related to the following location:
at com.colebatch.jaxb.order.FullName
and when I include them the output I get is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fullName>
<givenName>Dmitri</givenName>
<surname>Colebatch</surname>
<title>Mr</title>
<givenName>Dmitri</givenName>
<middleName>Feodor</middleName>
<surname>Colebatch</surname>
</fullName>
Note the doubling up of givenName and surname. I've had a quick look
at some of the annotations I'm not familiar with (including
XmlElements which I now think might solve my earlier problem) but
nothing jumps out at me.
Any thoughts on the above?
cheers
dim