46
47 public DateFormatProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags) {
48 this.type = type;
49 this.langtags = langtags;
50 }
51
52 /**
53 * Returns an array of all locales for which this locale service provider
54 * can provide localized objects or names.
55 *
56 * @return An array of all locales for which this locale service provider
57 * can provide localized objects or names.
58 */
59 @Override
60 public Locale[] getAvailableLocales() {
61 return LocaleProviderAdapter.toLocaleArray(langtags);
62 }
63
64 @Override
65 public boolean isSupportedLocale(Locale locale) {
66 return LocaleProviderAdapter.isSupportedLocale(locale, type, langtags);
67 }
68
69 /**
70 * Returns a new <code>DateFormat</code> instance which formats time
71 * with the given formatting style for the specified locale.
72 * @param style the given formatting style. Either one of
73 * {@link java.text.DateFormat#SHORT DateFormat.SHORT},
74 * {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},
75 * {@link java.text.DateFormat#LONG DateFormat.LONG}, or
76 * {@link java.text.DateFormat#FULL DateFormat.FULL}.
77 * @param locale the desired locale.
78 * @exception IllegalArgumentException if <code>style</code> is invalid,
79 * or if <code>locale</code> isn't
80 * one of the locales returned from
81 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
82 * getAvailableLocales()}.
83 * @exception NullPointerException if <code>locale</code> is null
84 * @return a time formatter.
85 * @see java.text.DateFormat#getTimeInstance(int, java.util.Locale)
86 */
|
46
47 public DateFormatProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags) {
48 this.type = type;
49 this.langtags = langtags;
50 }
51
52 /**
53 * Returns an array of all locales for which this locale service provider
54 * can provide localized objects or names.
55 *
56 * @return An array of all locales for which this locale service provider
57 * can provide localized objects or names.
58 */
59 @Override
60 public Locale[] getAvailableLocales() {
61 return LocaleProviderAdapter.toLocaleArray(langtags);
62 }
63
64 @Override
65 public boolean isSupportedLocale(Locale locale) {
66 return LocaleProviderAdapter.forType(type).isSupportedProviderLocale(locale, langtags);
67 }
68
69 /**
70 * Returns a new <code>DateFormat</code> instance which formats time
71 * with the given formatting style for the specified locale.
72 * @param style the given formatting style. Either one of
73 * {@link java.text.DateFormat#SHORT DateFormat.SHORT},
74 * {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},
75 * {@link java.text.DateFormat#LONG DateFormat.LONG}, or
76 * {@link java.text.DateFormat#FULL DateFormat.FULL}.
77 * @param locale the desired locale.
78 * @exception IllegalArgumentException if <code>style</code> is invalid,
79 * or if <code>locale</code> isn't
80 * one of the locales returned from
81 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
82 * getAvailableLocales()}.
83 * @exception NullPointerException if <code>locale</code> is null
84 * @return a time formatter.
85 * @see java.text.DateFormat#getTimeInstance(int, java.util.Locale)
86 */
|