You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Michael Mattox <mi...@gmail.com> on 2007/06/06 21:31:07 UTC
int 0..1 in my xsd is generated as int in Java instead of Integer
I have an XSD with int 0..1 and xmlbeans generates the java code with
int instead of Integer. I have tested with xfire and xfire generates
Integer. Anyone know why xmlbeans uses integer? Here is the part of
my xsd:
<element name="idProduction" type="int" maxOccurs="1"
minOccurs="0">
</element>
Thanks,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: int 0..1 in my xsd is generated as int in Java instead of Integer
Posted by Ole Matzura <ol...@eviware.com>.
Hi Michael,
XmlBeans usually also generates an "unsetXXX" method in these situations
which you can use to it to "null"..
regards,
/Ole
eviware.com
Michael Mattox wrote:
> Pim,
>
> I expect Integer because I have specified that the parameter is
> optional (0..1). Usually in SOAP when it's optional, Integer is used
> so that the value can be null. With int, there is no way to not pass
> a value.
>
> -Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: int 0..1 in my xsd is generated as int in Java instead of Integer
Posted by Michael Mattox <mi...@gmail.com>.
Pim,
I expect Integer because I have specified that the parameter is
optional (0..1). Usually in SOAP when it's optional, Integer is used
so that the value can be null. With int, there is no way to not pass
a value.
-Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: int 0..1 in my xsd is generated as int in Java instead of
Integer
Posted by Pim Tjeertes <Pi...@xs4all.nl>.
Hi Michael,
can explain why you expect an Integer object instead of an int Java
primitive.
I would be disappointed if xmlbeans would do it the otherway around.
Kind regards, Pim
On Wed, 2007-06-06 at 21:31 +0200, Michael Mattox wrote:
> I have an XSD with int 0..1 and xmlbeans generates the java code with
> int instead of Integer. I have tested with xfire and xfire generates
> Integer. Anyone know why xmlbeans uses integer? Here is the part of
> my xsd:
>
> <element name="idProduction" type="int" maxOccurs="1"
> minOccurs="0">
> </element>
>
> Thanks,
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
Re: int 0..1 in my xsd is generated as int in Java instead of Integer
Posted by Ole Matzura <ol...@eviware.com>.
Hi Michael,
you should be able to use the "isSetXXX" method to do something like
Integer intValue = myXmlBeansObj.isSetXXX() ? myXmlBeansObj.getXXX() : null;
Hope this helps!
regards,
/Ole
eviware.com
Michael Mattox wrote:
> "XmlBeans usually also generates an "unsetXXX" method in these
> situations which you can use to it to "null".."
>
> Ole,
>
> Can you explain how this works? If I receive an object and I call the
> getter to get the int, how do I know if it has been unset or not? I
> don't find anything about this in the xmlbeans documentation.
>
> Regards,
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org
Re: int 0..1 in my xsd is generated as int in Java instead of Integer
Posted by Michael Mattox <mi...@gmail.com>.
"XmlBeans usually also generates an "unsetXXX" method in these
situations which you can use to it to "null".."
Ole,
Can you explain how this works? If I receive an object and I call the
getter to get the int, how do I know if it has been unset or not? I
don't find anything about this in the xmlbeans documentation.
Regards,
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org