try {
List<?> l = List.class.cast(obj);
// do extra validation:
for(Object o : l) {
if(!(o instanceof File)) {
throw new WrongParameterValueException("Wrong parameter format for parameter \"" + getName() + "\". Given list contains objects of different type!");
}
}
// TODO: can we use reflection to get extra checks?
return (List<File>) l;
}
catch(ClassCastException e) {
// continue with others
}
if(obj instanceof String) {
String[] values = SPLIT.split((String) obj);
ArrayList<File> fileValue = new ArrayList<File>(values.length);
for(String val : values) {
fileValue.add(new File(val));
}
return fileValue;
}
throw new WrongParameterValueException("Wrong parameter format! Parameter \"" + getName() + "\" requires a list of file values!");
}