ws-wsif-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjiva Weerawarana" <sanj...@watson.ibm.com>
Subject Re: [wsif] generic type mapping [Re: bug 16485 [BeanDeserializer error when XML element starts with a capital letter]]
Date Thu, 20 Feb 2003 15:55:03 GMT
"Anthony Elder" <ant.elder@uk.ibm.com> writes:
> I think there may be some misunderstanding about this problem.
>
> If you have a Java bean with a field
>
>       String xyz;   // <-- starts with lowercase
>
> then Java conventions say there will be methods getXyz() and setXyz().
>
> If you change the field name to be:
>
>       String Xyz;   // <-- starts with uppercase
>
> then Java conventions say there will be methods getXyz() and setXyz().
Note
> the methods have identical names in both examples.
>
> The BeanSerializer uses the names of the methods to find what an XML
> element will map to. setXyz() is assumed to mean that there is a field
> named xyz, which maps to an element named xyz. But this assumption is
wrong
> in the second example, and if there is an element named Xyz there is *no
> way* in Java to differentiate the getter and setter methods.

Just to be clear - JavaBeans is a set of patterns on method names
only. There is no requirement whatsoever for there even to be a String
field representing the "xyz" property in this particular case. The
value can be stored as an int and then presented to the outside
world as a float.

Mime
View raw message