jaxb-ri
jaxb-ri copied to clipboard
From property usPrice xjc generates getUSPrice, but should be getUsPrice; the same for the setter.
In the modify-marshal sample there is in the po.xsd:
<xsd:element name="USPrice" type="xsd:decimal"/>
xjc generates an property usPrice with getter and setter getUSPrice and setUSPrice
.
But if you set @XmlAccessorType(XmlAccessType.PROPERTY)
on class Item, and you put the @XmlElement(name = "USPrice", required = true)
on the getter or setter of usPrice, then you will the that the getter and setter should be called getUsPrice
and setUsPrice
.
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/1149
- Original Issue Raised By:@ericjvandervelden
- Original Issue Assigned To: Unassigned
I've encountered very similar problem today. Generated accessor names seem to be (sometimes!) incompatible with JavaBeans convention (as @ericjvandervelden demonstrated).
In my case, it breaks ability to obtain PropertyDescriptor
from java.lang.reflect.Field
's name (using java.beans.Introspector
of course).
Here's xsd fragment:
<xs:element name="URI" type="xs:anyURI"/>
And here's fragment of generated code:
@XmlElement(name = "URI", required = true)
@XmlSchemaType(name = "anyURI")
protected String uri;
public String getURI() {
return uri;
}
public void setURI(String value) {
this.uri = value;
}
According to JavaBean convention, if I'm not wrong, it should be either uri + getUri + setUri or URI + getURI + setURI. As a workaround I use case-insensitive string comparison, but this is fragile and, hopefully, temporary solution.
Please let me know if I can help.