Top Description Fields Constructors Methods
sun.util.locale.provider

public Class DateFormatProviderImpl

extends DateFormatProvider
implements AvailableLanguageTags
Class Inheritance
All Implemented Interfaces
sun.util.locale.provider.AvailableLanguageTags
Imports
java.text.DateFormat, .SimpleDateFormat, java.text.spi.DateFormatProvider, java.util.Calendar, .Locale, .MissingResourceException, .Set, .TimeZone

Concrete implementation of the DateFormatProvider class for the JRE LocaleProviderAdapter.
Authors
Naoto Sato, Masayoshi Okutsu

Field Summary

Modifier and TypeField and Description
private final Set<String>
private final LocaleProviderAdapter.Type

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Set<String>
getAvailableLanguageTags()

Implements sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Returns a set of available language tags of a LocaleServiceProvider.
public Locale[]

Returns:

An array of all locales for which this locale service provider can provide localized objects or names.
getAvailableLocales
()

Implements abstract java.util.spi.LocaleServiceProvider.getAvailableLocales.

Returns an array of all locales for which this locale service provider can provide localized objects or names.
public DateFormat

Returns:

a date formatter.
getDateInstance
(int
the given formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.
style
,
Locale
the desired locale.
locale
)

Implements abstract java.text.spi.DateFormatProvider.getDateInstance.

Returns a new DateFormat instance which formats date with the given formatting style for the specified locale.
public DateFormat

Returns:

a date/time formatter.
getDateTimeInstance
(int
the given date formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.
dateStyle
,
int
the given time formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.
timeStyle
,
Locale
the desired locale.
locale
)

Implements abstract java.text.spi.DateFormatProvider.getDateTimeInstance.

Returns a new DateFormat instance which formats date and time with the given formatting style for the specified locale.
private DateFormat
getInstance(int dateStyle, int timeStyle, Locale locale)

public DateFormat

Returns:

a time formatter.
getTimeInstance
(int
the given formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.
style
,
Locale
the desired locale.
locale
)

Implements abstract java.text.spi.DateFormatProvider.getTimeInstance.

Returns a new DateFormat instance which formats time with the given formatting style for the specified locale.
public boolean
isSupportedLocale(Locale
a Locale to be tested
locale
)

Overrides java.util.spi.LocaleServiceProvider.isSupportedLocale.

Returns true if the given locale is supported by this locale service provider.

Field Detail

langtagsback to summary
private final Set<String> langtags
typeback to summary
private final LocaleProviderAdapter.Type type

Constructor Detail

DateFormatProviderImplback to summary
public DateFormatProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags)

Method Detail

getAvailableLanguageTagsback to summary
public Set<String> getAvailableLanguageTags()

Implements sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Doc from sun.util.locale.provider.AvailableLanguageTags.getAvailableLanguageTags.

Returns a set of available language tags of a LocaleServiceProvider. Note that the returned set doesn't contain the language tag for Locale.Root.

Returns:Set<String>

a Set of available language tags.

Annotations
@Override
getAvailableLocalesback to summary
public Locale[] getAvailableLocales()

Implements abstract java.util.spi.LocaleServiceProvider.getAvailableLocales.

Returns an array of all locales for which this locale service provider can provide localized objects or names.

Returns:Locale[]

An array of all locales for which this locale service provider can provide localized objects or names.

Annotations
@Override
getDateInstanceback to summary
public DateFormat getDateInstance(int style, Locale locale)

Implements abstract java.text.spi.DateFormatProvider.getDateInstance.

Returns a new DateFormat instance which formats date with the given formatting style for the specified locale.

Parameters
style:int

the given formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.

locale:Locale

the desired locale.

Returns:DateFormat

a date formatter.

Annotations
@Override
Exceptions
IllegalArgumentException:
if style is invalid, or if locale isn't one of the locales returned from getAvailableLocales().
NullPointerException:
if locale is null
See Also
java.text.DateFormat#getDateInstance(int, java.util.Locale)
getDateTimeInstanceback to summary
public DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)

Implements abstract java.text.spi.DateFormatProvider.getDateTimeInstance.

Returns a new DateFormat instance which formats date and time with the given formatting style for the specified locale.

Parameters
dateStyle:int

the given date formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.

timeStyle:int

the given time formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.

locale:Locale

the desired locale.

Returns:DateFormat

a date/time formatter.

Annotations
@Override
Exceptions
IllegalArgumentException:
if dateStyle or timeStyle is invalid, or if locale isn't one of the locales returned from getAvailableLocales().
NullPointerException:
if locale is null
See Also
java.text.DateFormat#getDateTimeInstance(int, int, java.util.Locale)
getInstanceback to summary
private DateFormat getInstance(int dateStyle, int timeStyle, Locale locale)
getTimeInstanceback to summary
public DateFormat getTimeInstance(int style, Locale locale)

Implements abstract java.text.spi.DateFormatProvider.getTimeInstance.

Returns a new DateFormat instance which formats time with the given formatting style for the specified locale.

Parameters
style:int

the given formatting style. Either one of DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, or DateFormat.FULL.

locale:Locale

the desired locale.

Returns:DateFormat

a time formatter.

Annotations
@Override
Exceptions
IllegalArgumentException:
if style is invalid, or if locale isn't one of the locales returned from getAvailableLocales().
NullPointerException:
if locale is null
See Also
java.text.DateFormat#getTimeInstance(int, java.util.Locale)
isSupportedLocaleback to summary
public boolean isSupportedLocale(Locale locale)

Overrides java.util.spi.LocaleServiceProvider.isSupportedLocale.

Doc from java.util.spi.LocaleServiceProvider.isSupportedLocale.

Returns true if the given locale is supported by this locale service provider. The given locale may contain extensions that should be taken into account for the support determination.

The default implementation returns true if the given locale is equal to any of the available Locales returned by getAvailableLocales() with ignoring any extensions in both the given locale and the available locales. Concrete locale service provider implementations should override this method if those implementations are Locale extensions-aware. For example, DecimalFormatSymbolsProvider implementations will need to check extensions in the given locale to see if any numbering system is specified and can be supported. However, CollatorProvider implementations may not be affected by any particular numbering systems, and in that case, extensions for numbering systems should be ignored.

Parameters
locale:Locale

a Locale to be tested

Returns:boolean

true if the given locale is supported by this provider; false otherwise.

Annotations
@Override