use of org.motechproject.mds.exception.csv.CsvImportException in project motech by motech.
the class CsvImporterExporter method buildRelationshipCollection.
private Collection<Object> buildRelationshipCollection(RelationshipHolder relationshipHolder) {
String collectionClassName = relationshipHolder.getCollectionClassName();
Class collectionClass = TypeHelper.suggestCollectionImplementation(collectionClassName);
if (collectionClass == null) {
return new ArrayList<>();
} else {
try {
return (Collection<Object>) collectionClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new CsvImportException("Unable to parse collection type " + relationshipHolder.getCollectionClassName(), e);
}
}
}
Aggregations