}
if (constructorValues == null)
constructorValues = new Object[0];
/* first load the innermost collection, ie the one that does the reading */
Collection rtr = null;
final String firstCollectionName = normaliseCollectionName(collNames[collCount-1]);
try{
Class<? extends Collection> collectionClass = Class.forName(firstCollectionName).asSubclass(Collection.class);
rtr = collectionClass.getConstructor(contructorTypes).newInstance(constructorValues); //collectionClass.newInstance();
} catch (ClassNotFoundException e) {
logger.error("ERROR: First Collection class named "+ firstCollectionName + " not found", e);
return null;
} catch (NoSuchMethodException e) {
logger.error("ERROR: First Collection class named "+ firstCollectionName + " - "+constructor+" constructor not found", e);
} catch (Exception e) {
logger.error("ERROR: First Collection class named "+ firstCollectionName + " - cannot be instantiated", e);
return null;
}
/* now load any wrapper collections requested */
int i = collCount-2;
if (collCount>1)
try{
for(;i>=0;i--)
{
Collection newColl = Class.forName(normaliseCollectionName(collNames[i]))
.asSubclass(Collection.class)
.getConstructor(new Class[]{Collection.class})
.newInstance(new Object[]{rtr});
rtr = newColl;
}