commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [configuration] AbstractConfiguration.Container
Date Tue, 22 Jun 2004 06:00:51 GMT
Emmanuel Bourg schrieb:
> Oliver Heger wrote:
>> I am not sure what the original intension of the authors was, but I 
>> could imagine the following:
>> If you have code like this:
>> configuration.addProperty("prop", "string1");
>> configuration.addProperty("prop", "string2");
>> String value = configuration.getString("prop");
>> How should the latter call be treated? I think ATM an exception will 
>> be thrown because the value of "prop" is a list rather than a string. 
>> An alternative approach would be that this call returned the first 
>> string in the list because the property has multiple values of type 
>> string (which may be appropriate for some use cases).
> Currently this code returns the first element of the list. I'm fine with 
> this behaviour.

Well I didn't check this. I knew that this was the original behaviour. 
When I wrote the XML howto I included a paragraph stating that 
getString() could be called on a property with multiple values and then 
returns the first value. Later somebody changed this into

"it is NOT legal to call getString()  or one of the other getter methods 
on a property with multiple values; as the entire list is attempted to 
be returned."

So I supposed that the getter methods have been changed, too. If this is 
not the case, documentation should be updated.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message