vJAXB 2.1.3 in JDK 1.6.x and later versions of xjc generate
public int getInheritedCount() {
if (inheritedCount == null) {
return 0;
} else {
return inheritedCount;
}
}
which is OK.
-W
On Tue, Jul 21, 2009 at 12:06 AM, Lucas Madar <lucas_at_mcsnw.com> wrote:
> Hello,
>
> I have an schema segment that looks like this:
>
> <xs:attribute name="inheritedCount" type="xs:int" use="optional">
>
> It generates code like this:
>
> @XmlAttribute(name = "inheritedCount")
> protected Integer inheritedCount;
>
> public int getInheritedCount() {
> return inheritedCount;
> }
>
> So, when getInheritedCount() is called, a NullPointerException is thrown
> when Java autoboxes Integer->int.
>
> Is there anyway to force JAXB/XJC to use Integer as a return type for
> xs:int?
>
> Thanks,
> Lucas Madar
>
>