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: Jakarta Commons Configuration - Problem with Variable Interpolation and StringArray
Date Wed, 10 Oct 2007 19:48:17 GMT
James Watkin wrote:
> I'm able to use Jakarta Commons Configuration with .properties files and 
> String[] properties, but when I use variable interpolation to refer to a 
> String[] property, it only returns the first element. Example:
> 
> .properties file contents:
> test.email.addresses = firstName1.LastName1@mydomain.edu, 
> firstName2.LastName2@mydomain.edu
> 
> test.email.recipients = ${test.email.addresses}
> 
> 
> Code:
> String[] testEmailAddresses = 
> config.getStringArray("test.email.addresses");
> 
> String[] testEmailRecipients = 
> config.getStringArray("test.email.recipients");
> 
> System.out.println("testEmailAddresses = " + 
> ArrayUtils.toString(testEmailAddresses));
> 
> System.out.println("testEmailRecipients = " + 
> ArrayUtils.toString(testEmailRecipients));
> 
> 
> Output:
> testEmailAddresses = 
> {firstName1.LastName1@mydomain.edu,firstName2.LastName2@mydomain.edu}
> testEmailRecipients = {firstName1.LastName1@mydomain.edu}
> 
> Shouldn't testEmailRecipients get the same String[] value as 
> testEmailAddresses? Am I doing something wrong, or can't this be done? 
> Is there a special recursive variable interpolation character for arrays?
> 
> - Jim


I am sorry, but interpolation of array values is not supported. Our 
interpolation implementation is pretty much String-based (behind the 
scenes we use the text package of Commons Lang [1], which only operates 
on Strings). So extending this to other types or even arrays and 
collections won't be trivial.

Oliver

[1] http://commons.apache.org/lang/

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


Mime
View raw message