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/07/18 17:08:13 UTC

Dozer & optional attributes - always zero

Hello,

I have a question about xmlbeans with Dozer.  We're having a problem
with optional attributes.  We have an integer that we specify in our
xsd as min and max occurs as 1 and nillable="true".  When we generate
our java classes with xmlbeans, we expect to have an attribute of type
Integer.  Instead of we have int and then a method isXSet.  This isn't
so bad, it's better to call isXSet rather than check for null, using
int is less painful than Integer, and the default value of zero is not
bad (better than null pointer).

However, this doesn't work with Dozer.  Dozer doesn't know about the
isXSet methods and therefore the value is always zero, even if it was
unset.

Has anyone had this problem?   Is it possible to configure xmlbeans to
create an Integer so that it'd work with Dozer?  Is there something to
configure with Dozer so that it knows about the isXSet methods??

Thanks,
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Dozer & optional attributes - always zero

Posted by Michael Mattox <mi...@gmail.com>.
> I don't think there is a way to make XmlBeans generate an Integer as
> BigInteger is the preferred type
> (http://xmlbeans.apache.org/docs/2.0.0/guide/conXMLBeansSupportBuiltInSchemaTypes.html).
> Would using xs:integer be an acceptable solution for you?

Using integer solved our problem.  Apparently my coworker was using
int.  Which oddly enough, produced an Integer in the code generated by
XFire.

Thanks for the help
-Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org


Re: Dozer & optional attributes - always zero

Posted by Jacob Danner <ja...@gmail.com>.
Hi Michael,
I haven't ever used Dozer so I can't comment on if this is actually
possible in Dozer without changing your schema as you've mentioned.
The Dozer website does mention its possible to have a primitive to
Primitve Wrapper with some configuration. I'm sure there mailing lists
might know the details better than I, but its looks like it might be
pretty simple (http://dozer.sourceforge.net/documentation/mappings.html)

I don't think there is a way to make XmlBeans generate an Integer as
BigInteger is the preferred type
(http://xmlbeans.apache.org/docs/2.0.0/guide/conXMLBeansSupportBuiltInSchemaTypes.html).
Would using xs:integer be an acceptable solution for you?

Hope this helps,
-Jacob Danner



On 7/18/07, Michael Mattox <mi...@gmail.com> wrote:
> Hello,
>
> I have a question about xmlbeans with Dozer.  We're having a problem
> with optional attributes.  We have an integer that we specify in our
> xsd as min and max occurs as 1 and nillable="true".  When we generate
> our java classes with xmlbeans, we expect to have an attribute of type
> Integer.  Instead of we have int and then a method isXSet.  This isn't
> so bad, it's better to call isXSet rather than check for null, using
> int is less painful than Integer, and the default value of zero is not
> bad (better than null pointer).
>
> However, this doesn't work with Dozer.  Dozer doesn't know about the
> isXSet methods and therefore the value is always zero, even if it was
> unset.
>
> Has anyone had this problem?   Is it possible to configure xmlbeans to
> create an Integer so that it'd work with Dozer?  Is there something to
> configure with Dozer so that it knows about the isXSet methods??
>
> Thanks,
> 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