if (type == Date.class) {
try {
return value == null ? null : getDateFormat().parse(
(String) value);
} catch (ParseException exception) {
throw new IsoConversionException(String.valueOf(value),
exception);
}
}
if (type == String.class) {
try {
return value == null ? null : getDateFormat().format(
(Date) value);
} catch (ClassCastException exception) {
throw new IsoConversionException(String.valueOf(value),
exception);
}
}
throw new IsoConversionNotSupportedException(type.getName());
}