users@jaxb.java.net

Re: JAXB 2.0 xs:int binding

From: Kasia Trapszo <kasia_at_trapszo.com>
Date: Thu, 06 Apr 2006 13:40:31 -0400

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.




On Fri, 2006-03-31 at 11:54 -0800, Kohsuke Kawaguchi wrote:
> Kasia Trapszo wrote:
> > I noticed when an xs:int type attribute is required the default binding
> > results in a primitive int type, if it's optional, result is an Integer
> > object.
>
> That's the intended behavior, so that you can check for non-existent
> attribute.
>
> JDK 5.0 autoboxing should let you convert between them without worrying
> too much.
>