SystemDateTimePatternManager { public static DateTimeFormatter getDateTimeFormatterByPattern(String customPattern, Locale locale) { if (locale == null || StringUtils.isEmpty(customPattern)) { return null; } String localeStr = locale.toString(); DateTimeFormatter formatter = dateTimeFormatterCache.get(customPattern + localeStr); if (formatter == null) { try { if (customPattern.contains(PATTERN_SUFFIX_ERA)) { formatter = ChronologyParameterManager.getDateTimeFormatterWithChronology(customPattern, locale); } else { String customPatternStrict = customPattern.replace('y', 'u'); formatter = new DateTimeFormatterBuilder() .parseCaseInsensitive() .appendPattern(customPatternStrict) .toFormatter(locale) .withResolverStyle(ResolverStyle.STRICT); } } catch (IllegalArgumentException e) { LOGGER.debug(e.getMessage(), e); return null; } dateTimeFormatterCache.put(customPattern + localeStr, formatter); } return formatter; }  static String[] getSupportedIsoLanguages(); static boolean isDate(String value); static boolean isTime(String value); static Map<String, Locale> getDatePatterns(String value); static Map<String, Locale> getDatePatterns(String value,
            SortedList<Map<Pattern, String>> frequentDatePatternsCache); static Map<String, Locale> getTimePatterns(String value); static DateTimeFormatter getDateTimeFormatterByPattern(String customPattern, Locale locale); static boolean isDate(String value, SortedList<Pair<Pattern, DateTimeFormatter>> orderedPatterns); static Set<String> getDatePatterns(); static boolean isMatchDateTimePattern(String value, String pattern, Locale locale); @Deprecated static boolean isMatchDateTimePattern(String value, String pattern);  }
@Test public void testgetDateTimeFormatterByPattern() { DateTimeFormatter dateTimeFormatterByPattern = SystemDateTimePatternManager.getDateTimeFormatterByPattern("dd/MM/yyyy", Locale.ENGLISH); assertFalse(dateTimeFormatterByPattern == null); assertTrue(dateTimeFormatterByPattern.getResolverStyle() == ResolverStyle.STRICT); assertEquals("17/08/2015", dateTimeFormatterByPattern.format(LocalDate.of(2015, 8, 17))); dateTimeFormatterByPattern = SystemDateTimePatternManager.getDateTimeFormatterByPattern("yyyy-MM-dd G", Locale.US); assertFalse(dateTimeFormatterByPattern == null); assertEquals("2015-08-17 AD", dateTimeFormatterByPattern.format(LocalDate.of(2015, 8, 17))); dateTimeFormatterByPattern = SystemDateTimePatternManager.getDateTimeFormatterByPattern("yyyy-MM-dd G", null); assertTrue(dateTimeFormatterByPattern == null); }