* @return Properties created from the Configuration
*/
public static Properties getProperties(Configuration config)
{
Properties props = new Properties();
ListDelimiterHandler listHandler;
boolean useDelimiterHandler;
if(config instanceof AbstractConfiguration)
{
listHandler = ((AbstractConfiguration) config).getListDelimiterHandler();
useDelimiterHandler = true;
}
else
{
listHandler = null;
useDelimiterHandler = false;
}
for (Iterator<String> keys = config.getKeys(); keys.hasNext();)
{
String key = keys.next();
List<Object> list = config.getList(key);
String propValue;
if (useDelimiterHandler)
{
try
{
propValue =
String.valueOf(listHandler.escapeList(list,
ListDelimiterHandler.NOOP_TRANSFORMER));
}
catch (Exception ex)
{
// obviously, the list handler does not support splitting