58
59 public CollatorProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags) {
60 this.type = type;
61 this.langtags = langtags;
62 }
63
64 /**
65 * Returns an array of all locales for which this locale service provider
66 * can provide localized objects or names.
67 *
68 * @return An array of all locales for which this locale service provider
69 * can provide localized objects or names.
70 */
71 @Override
72 public Locale[] getAvailableLocales() {
73 return LocaleProviderAdapter.toLocaleArray(langtags);
74 }
75
76 @Override
77 public boolean isSupportedLocale(Locale locale) {
78 return LocaleProviderAdapter.isSupportedLocale(locale, type, langtags);
79 }
80
81 /**
82 * Returns a new <code>Collator</code> instance for the specified locale.
83 * @param locale the desired locale.
84 * @return the <code>Collator</code> for the desired locale.
85 * @exception NullPointerException if
86 * <code>locale</code> is null
87 * @exception IllegalArgumentException if <code>locale</code> isn't
88 * one of the locales returned from
89 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
90 * getAvailableLocales()}.
91 * @see java.text.Collator#getInstance(java.util.Locale)
92 */
93 @Override
94 public Collator getInstance(Locale locale) {
95 if (locale == null) {
96 throw new NullPointerException();
97 }
98
|
58
59 public CollatorProviderImpl(LocaleProviderAdapter.Type type, Set<String> langtags) {
60 this.type = type;
61 this.langtags = langtags;
62 }
63
64 /**
65 * Returns an array of all locales for which this locale service provider
66 * can provide localized objects or names.
67 *
68 * @return An array of all locales for which this locale service provider
69 * can provide localized objects or names.
70 */
71 @Override
72 public Locale[] getAvailableLocales() {
73 return LocaleProviderAdapter.toLocaleArray(langtags);
74 }
75
76 @Override
77 public boolean isSupportedLocale(Locale locale) {
78 return LocaleProviderAdapter.forType(type).isSupportedProviderLocale(locale, langtags);
79 }
80
81 /**
82 * Returns a new <code>Collator</code> instance for the specified locale.
83 * @param locale the desired locale.
84 * @return the <code>Collator</code> for the desired locale.
85 * @exception NullPointerException if
86 * <code>locale</code> is null
87 * @exception IllegalArgumentException if <code>locale</code> isn't
88 * one of the locales returned from
89 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
90 * getAvailableLocales()}.
91 * @see java.text.Collator#getInstance(java.util.Locale)
92 */
93 @Override
94 public Collator getInstance(Locale locale) {
95 if (locale == null) {
96 throw new NullPointerException();
97 }
98
|