if (to.equals(Date.class)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
return to.cast(format.parse(value));
} catch (ParseException e) {
throw new ConfigurationException(value + " is not a valid Date, format should be YYYY-MM-DD.");
}
}
return chained.coerce(value, to);
}