java.text.spi

Class DateFormatProvider

public abstract class DateFormatProvider extends LocaleServiceProvider

A {@link DateFormatProvider} provides localized instances of {@link java.text.DateFormat}.

Since: 1.6

Constructor Summary
protected DateFormatProvider()
Constructs a new {@link DateFormatProvider}.
Method Summary
abstract DateFormatgetDateInstance(int style, Locale locale)
Returns a {@link java.text.DateFormat} instance for formatting dates with the given style in the specified {@link java.util.Locale}.
abstract DateFormatgetDateTimeInstance(int dateStyle, int timeStyle, Locale locale)
Returns a {@link java.text.DateFormat} instance for formatting dates and times with the given style in the specified {@link java.util.Locale}.
abstract DateFormatgetTimeInstance(int style, Locale locale)
Returns a {@link java.text.DateFormat} instance for formatting times with the given style in the specified {@link java.util.Locale}.

Constructor Detail

DateFormatProvider

protected DateFormatProvider()
Constructs a new {@link DateFormatProvider}. Provided for implicit invocation by subclasses.

Method Detail

getDateInstance

public abstract DateFormat getDateInstance(int style, Locale locale)
Returns a {@link java.text.DateFormat} instance for formatting dates with the given style in the specified {@link java.util.Locale}.

Parameters: style the formatting style; one of {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, {@link DateFormat#LONG} or {@link DateFormat#FULL}. locale the desired locale.

Returns: the localized instance for formatting dates.

Throws: NullPointerException if the locale is null. IllegalArgumentException if the style is invalid or the locale is not one returned by {@link getAvailableLocales()}

See Also: DateFormat

getDateTimeInstance

public abstract DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)
Returns a {@link java.text.DateFormat} instance for formatting dates and times with the given style in the specified {@link java.util.Locale}.

Parameters: dateStyle the date formatting style; one of {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, {@link DateFormat#LONG} or {@link DateFormat#FULL}. timeStyle the time formatting style; one of {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, {@link DateFormat#LONG} or {@link DateFormat#FULL}. locale the desired locale.

Returns: the localized instance for formatting dates.

Throws: NullPointerException if the locale is null. IllegalArgumentException if either style is invalid or the locale is not one returned by {@link getAvailableLocales()}

See Also: DateFormat

getTimeInstance

public abstract DateFormat getTimeInstance(int style, Locale locale)
Returns a {@link java.text.DateFormat} instance for formatting times with the given style in the specified {@link java.util.Locale}.

Parameters: style the formatting style; one of {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, {@link DateFormat#LONG} or {@link DateFormat#FULL}. locale the desired locale.

Returns: the localized instance for formatting times.

Throws: NullPointerException if the locale is null. IllegalArgumentException if the style is invalid or the locale is not one returned by {@link getAvailableLocales()}

See Also: DateFormat