in src/main/java/com/univocity/parsers/annotations/helpers/AnnotationHelper.java [393:451]
public static void applyFormatSettings(Object formatter, String[] propertiesAndValues) {
if (propertiesAndValues.length == 0) {
return;
}
Map<String, String> values = new HashMap<String, String>();
for (String setting : propertiesAndValues) {
if (setting == null) {
continue;
}
String[] pair = setting.split("=");
if (pair.length != 2) {
throw new DataProcessingException("Illegal format setting '" + setting + "' among: " + Arrays.toString(propertiesAndValues));
}
values.put(pair[0], pair[1]);
}
try {
for (PropertyWrapper property : BeanHelper.getPropertyDescriptors(formatter.getClass())) {
String name = property.getName();
String value = values.remove(name);
if (value != null) {
invokeSetter(formatter, property, value);
}
if ("decimalFormatSymbols".equals(property.getName())) {
DecimalFormatSymbols modifiedDecimalSymbols = new DecimalFormatSymbols();
boolean modified = false;
try {
for (PropertyWrapper prop : BeanHelper.getPropertyDescriptors(modifiedDecimalSymbols.getClass())) {
value = values.remove(prop.getName());
if (value != null) {
invokeSetter(modifiedDecimalSymbols, prop, value);
modified = true;
}
}
if (modified) {
Method writeMethod = property.getWriteMethod();
if (writeMethod != null) {
writeMethod.invoke(formatter, modifiedDecimalSymbols);
} else {
throw new IllegalStateException("No write method defined for property " + property.getName());
}
}
} catch (Throwable ex) {
throw new DataProcessingException("Error trying to configure decimal symbols of formatter '" + formatter.getClass() + '.', ex);
}
}
}
} catch (Exception e) {
//ignore and proceed
}
if (!values.isEmpty()) {
throw new DataProcessingException("Cannot find properties in formatter of type '" + formatter.getClass() + "': " + values);
}
}