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