commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <>
Subject RE: [Configuration] unary statement operator support
Date Wed, 22 Feb 2006 11:21:44 GMT
Hi Mikael,

Mikael Andersson wrote on Wednesday, February 22, 2006 11:32 AM:

> Hi,
> I wonder if there are plans to support the unary operator in the
> configuration files? (Given it isn't already supported, had a look at
> the project website but couldn't find any information regarding it).
> Would be great to have something like this supported:
> hello=Hi there ${$name ? $name : user }
> The reason I'm asking is because I'm having a look at
> potential libraries to
> use in a future project, and this feature is something which
> is neccessary
> for our configuration files.

No, something like this is not supported. Configurations could refactor the interpolation
into an Interface though, so different interpolation engines could be used (e.g. el or jexl).

Apart from this, you might solve your problem with a CompositeConfiguration:

CompositeConfiguration config = new CompositeConfiguration();
config.addConfiguration(new PropertiesConfiguration(""));
config.addConfiguration(new PropertiesConfiguration(App.class.getResource("")));

Here the defaults are stores in a file available from the class loader. This file would contain


The file would contain your line:

hello=Hi there ${name}

And if you app is started with -Dname="John Doe" it would interpolate to the correct value.

- Jörg

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

View raw message