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 = [EMAIL PROTECTED],
[EMAIL PROTECTED]
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 =
[EMAIL PROTECTED],[EMAIL PROTECTED]
testEmailRecipients = [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]