return conversionService.convert(value, TypeDescriptor.forObject(value),
methodParameter.getTypeDescriptor());
} catch (ConversionFailedException e) {
// ignore this exception for collections and arrays.
// try to convert the value with jackson
TypeFactory typeFactory = jsonHandler.getMapper().getTypeFactory();
if (methodParameter.getTypeDescriptor().isCollection()) {
JavaType type = CollectionType.construct(
methodParameter.getType(),
typeFactory.constructType(methodParameter.getTypeDescriptor()
.getElementTypeDescriptor().getType()));
return jsonHandler.convertValue(value, type);
} else if (methodParameter.getTypeDescriptor().isArray()) {
JavaType type = typeFactory.constructArrayType(methodParameter.getTypeDescriptor()
.getElementTypeDescriptor().getType());
return jsonHandler.convertValue(value, type);
}
throw e;