users@jaxb.java.net

xs:int and getter return types

From: Lucas Madar <lucas_at_mcsnw.com>
Date: Mon, 20 Jul 2009 15:06:28 -0700

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