You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Lautaro Brasseur <lb...@yahoo.com> on 2010/12/10 13:26:24 UTC
[configuration]
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
Re: [configuration]
Posted by Oliver Heger <ol...@oliver-heger.de>.
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