APIdia Launch Partner
Top Description Constructors Methods
java.time.format

public abstract Class DateTimeFormatterPatternProvider

extends LocaleServiceProvider
Class Inheritance
Known Direct Subclasses
sun.util.locale.provider.DateTimeFormatterPatternProviderImpl, sun.util.locale.provider.SPILocaleProviderAdapter.DateTimeFormatterPatternProviderDelegate
Imports
java.time.DateTimeException, java.time.chrono.Chronology, java.util.Locale, java.util.spi.LocaleServiceProvider

Service Provider Interface for retrieving localized patterns used by DateTimeFormatter and DateTimeFormatterBuilder classes. The methods in this class provide localized format pattern strings for use with methods such as ofLocalizedDateTime(FormatStyle) and appendLocalized(FormatStyle, FormatStyle). For details on using the Locale Sensitive SPI, see LocaleServiceProvider.
Since
27

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public abstract String

Returns:

the localized pattern string for the date style, time style, calendar type, and locale
getDateTimeFormatterPattern
(FormatStyle
FormatStyle representing date style. null for time-only pattern
dateStyle
,
FormatStyle
FormatStyle representing time style. null for date-only pattern
timeStyle
,
String
Non-null String representing a CLDR/LDML calendar type, such as "japanese", "iso8601".
calType
,
Locale
Locale used to obtain the localized pattern. Non-null.
locale
)

Returns the localized pattern string for the date style, time style, calendar type, and locale.

public abstract String

Returns:

the localized pattern string for the requested template, calendar type, and locale
getDateTimeFormatterPattern
(String
requested template, Non-null.
requestedTemplate
,
String
Non-null String representing a CLDR/LDML calendar type, such as "japanese", "iso8601".
calType
,
Locale
the Locale used to obtain the localized pattern. Non-null.
locale
)

Returns the localized pattern string for the requested template, calendar type, and locale.

Inherited from java.util.spi.LocaleServiceProvider:
getAvailableLocalesisSupportedLocale

Constructor Detail

DateTimeFormatterPatternProviderback to summary
protected DateTimeFormatterPatternProvider()

Sole constructor. (For invocation by subclass constructors, typically implicit.)

Method Detail

getDateTimeFormatterPatternback to summary
public abstract String getDateTimeFormatterPattern(FormatStyle dateStyle, FormatStyle timeStyle, String calType, Locale locale)

Returns the localized pattern string for the date style, time style, calendar type, and locale. Either dateStyle or timeStyle may be null. In such cases, the returned pattern represents only the time or only the date, respectively. If both are null, an IllegalArgumentException is thrown.

Parameters
dateStyle:FormatStyle

FormatStyle representing date style. null for time-only pattern

timeStyle:FormatStyle

FormatStyle representing time style. null for date-only pattern

calType:String

Non-null String representing a CLDR/LDML calendar type, such as "japanese", "iso8601".

locale:Locale

Locale used to obtain the localized pattern. Non-null.

Returns:String

the localized pattern string for the date style, time style, calendar type, and locale

Exceptions
IllegalArgumentException:
if both dateStyle and timeStyle are null.
DateTimeException:
if no formatting pattern is available for the specified arguments.
NullPointerException:
if calType or locale is null.
See Also
Chronology#getCalendarType()
getDateTimeFormatterPatternback to summary
public abstract String getDateTimeFormatterPattern(String requestedTemplate, String calType, Locale locale)

Returns the localized pattern string for the requested template, calendar type, and locale. The requestedTemplate must match the regular expression described in DateTimeFormatterBuilder#appendLocalized(String); otherwise, an IllegalArgumentException is thrown.

Parameters
requestedTemplate:String

requested template, Non-null.

calType:String

Non-null String representing a CLDR/LDML calendar type, such as "japanese", "iso8601".

locale:Locale

the Locale used to obtain the localized pattern. Non-null.

Returns:String

the localized pattern string for the requested template, calendar type, and locale

Exceptions
IllegalArgumentException:
if requestedTemplate does not match the regular expression syntax described in appendLocalized(String).
DateTimeException:
if no formatting pattern is available for the specified arguments.
NullPointerException:
if requestedTemplate, calType, or locale is null.
See Also
DateTimeFormatterBuilder#appendLocalized(String), Chronology#getCalendarType()