@Override
  public DateTimeFormatter getFormatter(FormatStyle dateStyle, FormatStyle timeStyle, Chrono<?> chrono, Locale locale) {

    if (dateStyle == null && timeStyle == null) {
      throw new IllegalArgumentException("Date and Time style must not both be null");
    }
    String key = chrono.getId() + '|' + locale.toString() + '|' + dateStyle + timeStyle;
    Object cached = FORMATTER_CACHE.get(key);
    if (cached != null) {
      if (cached.equals("")) {
        throw new IllegalArgumentException("Unable to convert DateFormat to DateTimeFormatter");
      }
      return (DateTimeFormatter) cached;
    }
    DateFormat dateFormat;
    if (dateStyle != null) {
      if (timeStyle != null) {
        dateFormat = DateFormat.getDateTimeInstance(convertStyle(dateStyle), convertStyle(timeStyle), locale);
      } else {
        dateFormat = DateFormat.getDateInstance(convertStyle(dateStyle), locale);
      }
    } else {
      dateFormat = DateFormat.getTimeInstance(convertStyle(timeStyle), locale);
    }
    if (dateFormat instanceof SimpleDateFormat) {
      String pattern = ((SimpleDateFormat) dateFormat).toPattern();
      DateTimeFormatter formatter = new DateTimeFormatterBuilder().appendPattern(pattern).toFormatter(locale);
      FORMATTER_CACHE.putIfAbsent(key, formatter);
      return formatter;
    }
    FORMATTER_CACHE.putIfAbsent(key, "");
    throw new IllegalArgumentException("Unable to convert DateFormat to DateTimeFormatter");
  }