users@jaxb.java.net

Re: JAXB 2.0 xs:int binding

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 10 Apr 2006 18:06:03 -0700

Kasia Trapszo wrote:
> Unfortunately that causes problems migrating from jaxb 1 to 2. Since the
> generated code returns a primitive type that is internally stored as an
> Integer, calling "getSomething" generates a NullPointer exception when
> that value is not set. That's a lot of code that now has to be changed
> to first check the "isSet" value when with jaxb 1 it was checking for a
> int <= 0 value.

I see. What about if you use XSLT to remove all optionality from
attributes, just for XJC?

I guess you won't be able to detect the absence of an attribute though.

You can write a plugin and replace FieldRendererFactory.getSingle() and
returns a slightly modified version that returns VM-uninitialized value,
maybe?

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com