dynamic
convertParameterListWithMirror(List<String> parameterValues, TypeMirror typeMirror)
Source
dynamic convertParameterListWithMirror(
List<String> parameterValues, TypeMirror typeMirror) {
if (parameterValues == null) {
return null;
}
if (typeMirror.isSubtypeOf(reflectType(List))) {
return parameterValues
.map((str) =>
convertParameterWithMirror(str, typeMirror.typeArguments.first))
.toList();
} else {
if (parameterValues.length > 1) {
throw new InternalControllerException(
"Duplicate value for parameter", HttpStatus.BAD_REQUEST,
errorMessage: "Duplicate parameter for non-List parameter type");
}
return convertParameterWithMirror(parameterValues.first, typeMirror);
}
}