DataFormat { @NonNull public static DataFormat of(@Nullable Locale locale, @Nullable String datePattern, @Nullable String numberPattern) { return new DataFormat(locale, Strings.nullToEmpty(datePattern), Strings.nullToEmpty(numberPattern), null); } private  DataFormat(Locale locale, String datePattern, String numberPattern, Void fake); @Deprecated  DataFormat(@Nullable Locale locale, @Nullable String datePattern); @Deprecated  DataFormat(@Nullable Locale locale, @Nullable String datePattern, @Nullable String numberPattern); @NonNull static DataFormat of(@Nullable Locale locale, @Nullable String datePattern, @Nullable String numberPattern); @NonNull String getNumberPattern(); @NonNull String getDatePattern(); @Nullable Locale getLocale(); @NonNull String getLocaleString(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); Formatters.@NonNull Formatter<Date> dateFormatter(); Parsers.@NonNull Parser<Date> dateParser(); Formatters.@NonNull Formatter<Number> numberFormatter(); Parsers.@NonNull Parser<Number> numberParser(); @NonNull DateFormat newDateFormat(); @NonNull NumberFormat newNumberFormat(); @Deprecated @NonNull static DataFormat create(@Nullable String locale, @Nullable String datePattern); @Deprecated @NonNull static DataFormat create(@Nullable String locale, @Nullable String datePattern, @Nullable String numberPattern); @Deprecated @NonNull static Parser<Locale> localeParser(); @Deprecated @NonNull static Locale toLocale(@NonNull String str); @Deprecated @Nullable String previewDate(); @Deprecated @NonNull static DateFormat newDateFormat(@Nullable String datePattern, @Nullable Locale locale); @Deprecated @NonNull static NumberFormat newNumberFormat(@Nullable Locale locale); static final DataFormat DEFAULT; static final DataFormat ROOT; static final String SEP; }
@Test public void testFactories() { assertThat(of(null, null, null)) .extracting(DataFormat::getLocale, DataFormat::getDatePattern, DataFormat::getNumberPattern) .containsExactly(null, "", ""); assertThat(of(FRENCH, null, null)) .extracting(DataFormat::getLocale, DataFormat::getDatePattern, DataFormat::getNumberPattern) .containsExactly(FRENCH, "", ""); assertThat(of(null, "yyyy", null)) .extracting(DataFormat::getLocale, DataFormat::getDatePattern, DataFormat::getNumberPattern) .containsExactly(null, "yyyy", ""); assertThat(of(null, null, "#0.00")) .extracting(DataFormat::getLocale, DataFormat::getDatePattern, DataFormat::getNumberPattern) .containsExactly(null, "", "#0.00"); }