else if (Number.class.isAssignableFrom(this.requiredType) && Number.class.isInstance(result)) {
try {
result = NumberUtils.convertNumberToTargetClass(((Number) result), this.requiredType);
}
catch (IllegalArgumentException ex) {
throw new TypeMismatchDataAccessException(ex.getMessage());
}
}
else {
throw new TypeMismatchDataAccessException(
"Result object with column type '" + rsmd.getColumnTypeName(1) +
"' and value [" + result + "] is of type [" + rsmd.getColumnClassName(1) +
"] and could not be converted to required type [" + this.requiredType.getName() + "]");
}
}