commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: [configuration]
Date Fri, 10 Dec 2010 20:11:39 GMT
Hi Lautaro,

Am 10.12.2010 13:26, schrieb Lautaro Brasseur:
> I'm trying to use the CompositeConfiguration class:
>
> http://commons.apache.org/configuration/userguide/howto_compositeconfiguration.html#Setting_Up_Defaults
>
>
> but I didn't found the method a=dDefaults referenced in that page. Is there any
> replacement?
>
> Thanks in advance.
>
> Lautaro
>

this example is wrong. The last line should run
cc.addConfiguration(fileToDefaults);

When asked for a property CompositeConfiguration searches all contained 
configuration objects in the order they were added. The first value 
found is returned. So you can achieve a defaults mechanism by simply 
adding the configuration with the default values as the last 
configuration: it is then queried if no other configuration object 
contains the property in question.

Oliver

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


Mime
View raw message