}
@Override
public <V> V getValue(Object component, AnnotatedElement target, Type genericType, Class<V> type) throws MultiException {
// look for the name in the list of parameters passed.
Param param = target.getAnnotation(Param.class);
String paramName = CommandModel.getParamName(param, target);
if (param.primary()) {
// this is the primary parameter for the command
List<String> value = parameters.get("DEFAULT");
if (value != null && value.size() > 0) {
/*
* If the operands are uploaded files, replace the
* client-provided values with the paths to the uploaded files.
* XXX - assume the lists are in the same order.
*/
final List<String> filePaths = getUploadedFileParamValues(
"DEFAULT",
type, optionNameToUploadedFileMap);
if (filePaths != null) {
value = filePaths;
// replace the file name operands with the uploaded files
parameters.set("DEFAULT", value);
} else {
for (String s : value) {
checkAgainstAcceptableValues(target, s);
}
}
// let's also copy this value to the cmd with a real name
parameters.set(paramName, value);
V paramValue = (V) convertListToObject(target, type, value);
return paramValue;
}
}
if (param.multiple()) {
List<String> value = parameters.get(paramName);
if (value != null && value.size() > 0) {
final List<String> filePaths = getUploadedFileParamValues(
paramName,
type, optionNameToUploadedFileMap);