commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertdon...@mac.com>
Subject Re: [beanutils] case sensitivity & digester (proposal)
Date Wed, 10 Jul 2002 17:39:57 GMT

On Wednesday, July 10, 2002, at 04:57 PM, Craig R. McClanahan wrote:

> I don't particularly like the idea of making Digester non-case-sensitive.
> Everything else about XML *is* case sensitive, and so is JavaBeans
> introspection -- it would be very confusing to have this work differently.

+1

i think that digester should support precision and correctness over ease 
of use. i'd say that automated mapping strategies are better left to 
betwixt. (having said that, i'd like to be able to mix-and-match betwixt 
with custom digester rulesets - but that's a different question...)

what i have been looking at (in response to another user problem) is 
adding another constructor to setPropertiesRule that allows the user to 
override attribute name to property mappings. the idea would be that a 
couple of string arrays could be passed in allowing the attribute name -> 
property name mappings to be customized. (i don't know if anyone else has 
any opinions on this plan...)

i think that this should allow the example mapping to be reasonably easily 
constructed. each property mapping where the property name didn't match 
the attribute name would have to be specified - but if a general strategy 
is what's wanted then probably betwixt should be used.

- robert


>
> Craig
>
>
> On Wed, 10 Jul 2002, Bart De Gruyter wrote:
>
>> Date: Wed, 10 Jul 2002 11:53:14 +0200
>> From: Bart De Gruyter <bdg@pobox.com>
>> Reply-To: Jakarta Commons Developers List <commons-
>> dev@jakarta.apache.org>
>> To: commons-dev@jakarta.apache.org
>> Subject: [beanutils] case sensitivity & digester (proposal)
>>
>> Hi,
>>
>> When using digester to "digest" the following
>> XML into a Java object you will get problems:
>>
>> <pushtransport AckHost="131.176.20.102">
>>
>> into:
>>
>> public class PushTransport {
>> ...
>>
>>      public void setAckHost(java.lang.String aAckHost) {
>> ...
>>      }
>>
>>
>>      public String getSendAck() {
>> ...
>>      }
>> ...
>>
>>
>>
>> Because the common-beanutils package uses introspection
>> to get to know the property name of AckHost it will
>> be transformed into ackHost; hence the digester
>> rule for "AckHost" will never match a property of
>> class PushTransport.
>>
>> Therefore I propose a change in common-beanutils:
>>
>> in the following file:
>>
>> /home/cvspublic/jakarta-
>> commons/beanutils/src/java/org/apache/commons/beanutils/PropertyUtils.java,
>> v1.27
>> 2002/07/07 23:17:59
>>
>> diff:
>>
>> 852c852
>> <                 if (name.equals(descriptors[i].getName()))
>> ---
>>>                 if
>> (Introspector.decapitalize(name).equals(descriptors[i].getName()))
>>
>>
>>
>> I do not have cvs commit access; and would like to know if the
>> project team would agree that this is a useful bugfix or if
>> I am using the digester in a wrong way.
>>
>>
>> friendly greetings,
>>
>> Bart De Gruyter
>>
>>
>> --
>> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.
>> org>
>> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.
>> org>
>>
>>
>
>
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.
> org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.
> org>
>


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message