commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Siegmar <oli...@siegmar.net>
Subject Re: [configuration] IniFile support
Date Thu, 14 Apr 2005 09:56:41 GMT
On Thursday 14 April 2005 11:42, Emmanuel Bourg wrote:
> Ok I see your point. There was a support for default values in
> PropertiesConfiguration some time ago but we removed it in favor of
> CompositeConfiguration. For consistency I think we will apply the same
> reasoning for INIConfiguration, that means you can emulate a similar
> behaviour with:

Sounds reasonable.

> Configuration iniconf = new INIConfiguration("config.ini");
> CompositeConfiguration conf = new CompositeConfiguration();
> conf.addConfiguration(iniconf.subset("section1"));
> conf.addConfiguration(iniconf.subset("default"));
>
> conf.getString("val") -> returns 50
>
>
> To make it easier I could add a method in INIConfiguration that build
> this CompositeConfiguration automatically. Something like:
>
> Configuration conf = iniconf.getSection("section1", "default");
> conf.getString("val");

I can live with that. The only drawback I see is, you have to know all 
sections your application will use in advance, right?


Best,
Oliver

---------------------------------------------------------------------
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