@Test public void testParsePointInTimeWithInvalidStrings() { try { FileManDateTimeFormat.parse("275"); Assert.fail("expected " + IllegalArgumentException.class); } catch (IllegalArgumentException e) { } try { FileManDateTimeFormat.parse("2750000."); Assert.fail("expected " + IllegalArgumentException.class); } catch (IllegalArgumentException e) { } }
public static PointInTime parse(String text) { if (text == null) return null; if (text.isEmpty()) return null; Matcher fileManMatcher = FILE_MAN_DATE_PATTERN.matcher(text); if (!fileManMatcher.matches()) { try { PointInTime t = RelativeDateTimeFormat.parse(text); return t; } catch (IllegalArgumentException relativeParseException) { } throw new IllegalArgumentException("'" + text + "' is not a recognized FileMan date/time pattern"); } if (isMidnight(text)) { return convertMidnightToOneMillisecondBefore(text); } PointInTime t = pointInTimeParser().parsePointInTime(text); if (t.getPrecision().greaterThanOrEquals(Precision.HOUR)) t = t.promote().getLow(); return t; }
FileManDateTimeFormat { public static PointInTime parse(String text) { if (text == null) return null; if (text.isEmpty()) return null; Matcher fileManMatcher = FILE_MAN_DATE_PATTERN.matcher(text); if (!fileManMatcher.matches()) { try { PointInTime t = RelativeDateTimeFormat.parse(text); return t; } catch (IllegalArgumentException relativeParseException) { } throw new IllegalArgumentException("'" + text + "' is not a recognized FileMan date/time pattern"); } if (isMidnight(text)) { return convertMidnightToOneMillisecondBefore(text); } PointInTime t = pointInTimeParser().parsePointInTime(text); if (t.getPrecision().greaterThanOrEquals(Precision.HOUR)) t = t.promote().getLow(); return t; } }
FileManDateTimeFormat { public static PointInTime parse(String text) { if (text == null) return null; if (text.isEmpty()) return null; Matcher fileManMatcher = FILE_MAN_DATE_PATTERN.matcher(text); if (!fileManMatcher.matches()) { try { PointInTime t = RelativeDateTimeFormat.parse(text); return t; } catch (IllegalArgumentException relativeParseException) { } throw new IllegalArgumentException("'" + text + "' is not a recognized FileMan date/time pattern"); } if (isMidnight(text)) { return convertMidnightToOneMillisecondBefore(text); } PointInTime t = pointInTimeParser().parsePointInTime(text); if (t.getPrecision().greaterThanOrEquals(Precision.HOUR)) t = t.promote().getLow(); return t; } protected  FileManDateTimeFormat(); }
FileManDateTimeFormat { public static PointInTime parse(String text) { if (text == null) return null; if (text.isEmpty()) return null; Matcher fileManMatcher = FILE_MAN_DATE_PATTERN.matcher(text); if (!fileManMatcher.matches()) { try { PointInTime t = RelativeDateTimeFormat.parse(text); return t; } catch (IllegalArgumentException relativeParseException) { } throw new IllegalArgumentException("'" + text + "' is not a recognized FileMan date/time pattern"); } if (isMidnight(text)) { return convertMidnightToOneMillisecondBefore(text); } PointInTime t = pointInTimeParser().parsePointInTime(text); if (t.getPrecision().greaterThanOrEquals(Precision.HOUR)) t = t.promote().getLow(); return t; } protected  FileManDateTimeFormat(); static DateTimeFormatter date(); static DateTimeFormatter time(); static DateTimeFormatter dateTime(); static PointInTimeFormatter pointInTimeParser(); static PointInTime parse(String text); static PointInTime toPointInTime(String text); static PointInTime parsePointInTime(String text); static LocalDateTime parseLocalDateTime(String text); }
FileManDateTimeFormat { public static PointInTime parse(String text) { if (text == null) return null; if (text.isEmpty()) return null; Matcher fileManMatcher = FILE_MAN_DATE_PATTERN.matcher(text); if (!fileManMatcher.matches()) { try { PointInTime t = RelativeDateTimeFormat.parse(text); return t; } catch (IllegalArgumentException relativeParseException) { } throw new IllegalArgumentException("'" + text + "' is not a recognized FileMan date/time pattern"); } if (isMidnight(text)) { return convertMidnightToOneMillisecondBefore(text); } PointInTime t = pointInTimeParser().parsePointInTime(text); if (t.getPrecision().greaterThanOrEquals(Precision.HOUR)) t = t.promote().getLow(); return t; } protected  FileManDateTimeFormat(); static DateTimeFormatter date(); static DateTimeFormatter time(); static DateTimeFormatter dateTime(); static PointInTimeFormatter pointInTimeParser(); static PointInTime parse(String text); static PointInTime toPointInTime(String text); static PointInTime parsePointInTime(String text); static LocalDateTime parseLocalDateTime(String text);  }