commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <Joerg.Schai...@Elsag-Solutions.com>
Subject RE: [configuration] SubsetConfiguration
Date Fri, 05 Mar 2004 11:16:49 GMT
Emmanuel Bourg wrote on Friday, March 05, 2004 11:38 AM:

> Jörg Schaible wrote:
> 
>> after recognizing, that you've attached the diff, I had a look at the
>> changes in the test case. I am not quite sure, that this is really
>> good. Intentionally I thought, you would return an empty
>> configuration only, if the pattern equals the key, but you do so now
>> also if the pattern does not match at all.
>> 
>> This will break my usage of Configuration for certain and I am
>> probably not alone here.
> 
> You expect subset() to return a null configuration instead of
> an empty
> configuration ?
> 
> I see one issue with the current implementation, it is not
> possible to
> access the property in the parent configuration with a key
> matching the
> prefix of the subset (the subset root property):
> 
> conf.setProperty("x.y.z", "1");
> subset = conf.subset("x.y.z");
> 
> Here subset is empty and I can't read the value of "x.y.z".

Well, in the previous implementation this was thew special case and the subset has exactly
one property "x.y.z" with value 1. Your implementation delivers an empty configuration, right?
Fine with me.

Looking at the changes for teh test cases, I have the impression that

conf.setProperty("x.y.z", "1");
subset = conf.subset("x.y.z.not_there");

will also return an empty configuration, whereas this return value was previously always just
null.

> If I call
> subset.getProperty("") it will return null because the key "x.y.z."
> doesn't exist in the parent configuration. I think I'll change the
> implementation I suggested to allow the use of a null (or "" ?) key to
> access the subset root property, that's
> subset.getProperty(null) returns
> "1".

OK. this makes more sense than the empty configuration.

Regards,
Jörg

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


Mime
View raw message