< prev index next >

src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java

Print this page
rev 47925 : 8191349: Add a new method in j.t.f.DateTimeFormatter to reflect Unicode extensions
Reviewed-by:

*** 2160,2175 **** * using the default locale. * <p> * This will create a formatter with the {@linkplain Locale#getDefault(Locale.Category) default FORMAT locale}. * Numbers will be printed and parsed using the standard DecimalStyle. * The resolver style will be {@link ResolverStyle#SMART SMART}. - * If the default locale contains "ca" (calendar), "rg" (region override) - * and/or "tz" (timezone) - * <a href="../../util/Locale.html#def_locale_extension">Unicode extensions</a>, - * the chronology and/or the zone are overridden. If both "ca" and "rg" are - * specified, the chronology from the "ca" extension supersedes the implicit one - * from the "rg" extension. * <p> * Calling this method will end any open optional sections by repeatedly * calling {@link #optionalEnd()} before creating the formatter. * <p> * This builder can still be used after creating the formatter if desired, --- 2160,2169 ----
*** 2186,2201 **** * using the specified locale. * <p> * This will create a formatter with the specified locale. * Numbers will be printed and parsed using the standard DecimalStyle. * The resolver style will be {@link ResolverStyle#SMART SMART}. - * If the specified locale contains "ca" (calendar), "rg" (region override) - * and/or "tz" (timezone) - * <a href="../../util/Locale.html#def_locale_extension">Unicode extensions</a>, - * the chronology and/or the zone are overridden. If both "ca" and "rg" are - * specified, the chronology from the "ca" extension supersedes the implicit one - * from the "rg" extension. * <p> * Calling this method will end any open optional sections by repeatedly * calling {@link #optionalEnd()} before creating the formatter. * <p> * This builder can still be used after creating the formatter if desired, --- 2180,2189 ----
*** 2230,2251 **** Objects.requireNonNull(locale, "locale"); while (active.parent != null) { optionalEnd(); } CompositePrinterParser pp = new CompositePrinterParser(printerParsers, false); - - // Check for chronology/timezone in locale object - Chronology c = locale.getUnicodeLocaleType("ca") != null ? - Chronology.ofLocale(locale) : chrono; - String tzType = locale.getUnicodeLocaleType("tz"); - ZoneId z = tzType != null ? - TimeZoneNameUtility.convertLDMLShortID(tzType) - .map(ZoneId::of) - .orElse(null) : - null; return new DateTimeFormatter(pp, locale, DecimalStyle.STANDARD, ! resolverStyle, null, c, z); } //----------------------------------------------------------------------- /** * Strategy for formatting/parsing date-time information. --- 2218,2229 ---- Objects.requireNonNull(locale, "locale"); while (active.parent != null) { optionalEnd(); } CompositePrinterParser pp = new CompositePrinterParser(printerParsers, false); return new DateTimeFormatter(pp, locale, DecimalStyle.STANDARD, ! resolverStyle, null, chrono, null); } //----------------------------------------------------------------------- /** * Strategy for formatting/parsing date-time information.
< prev index next >