public Date parse(String value) {
if (IS_LONG_PATTERN.matcher(value).matches()) {
try {
return new Date(Long.parseLong(value));
} catch (NumberFormatException e) {
throw new InvalidTypeException(String.format("Cannot parse timestamp value from \"%s\"", value));
}
}
try {
return parseDate(value, iso8601Patterns);
} catch (ParseException e) {
throw new InvalidTypeException(String.format("Cannot parse date value from \"%s\"", value));
}
}