parameterType = targetType.getJavaTypeParameter(0);
}
// bail if we don't have a parameter type
if (parameterType==null) {
throw new ConversionException(
"Unable to determine parameterType of "+targetType);
}
// get target class
Class<?> targetClass = targetType.asClass();
// create collection
Collection ret;
if (!targetClass.isInterface()) {
try {
ret = Collection.class.cast(ReflectionUtil.instantiate(targetClass));
} catch (Exception e) {
throw new ConversionException("Couldn't instantiate "+targetClass.getName(), e);
}
} else if (SortedSet.class.isAssignableFrom(targetClass)) {
// get comparator hint
String comaparatorClassName = hints.get(HINT_COMPARATOR_CLASS);
// create the comparator if we can
Comparator<?> comparator = null;
if (comaparatorClassName!=null) {
try {
comparator = Comparator.class.cast(
ReflectionUtil.instantiate(Class.forName(comaparatorClassName)));
} catch(Exception e) {
throw new ConversionException("Error creating comparator: "+comaparatorClassName);
}
}
// create TreeSet
ret = (comparator!=null)