ICU-2203 registration for calendar, breakiterator, update service APIs

X-SVN-Rev: 9972
This commit is contained in:
Doug Felt 2002-10-04 19:49:10 +00:00
parent 5dcdf3046e
commit 7e8cea4c33
2 changed files with 32 additions and 27 deletions

View File

@ -5,8 +5,8 @@
*******************************************************************************
*
* $Source: /xsrl/Nsvn/icu/icu4j/src/com/ibm/icu/text/NumberFormat.java,v $
* $Date: 2002/10/04 19:41:02 $
* $Revision: 1.16 $
* $Date: 2002/10/04 19:49:10 $
* $Revision: 1.17 $
*
*****************************************************************************************
*/
@ -163,7 +163,7 @@ import com.ibm.icu.impl.LocaleUtility;
*
* see DecimalFormat
* see java.text.ChoiceFormat
* @version $Revision: 1.16 $
* @version $Revision: 1.17 $
* @author Mark Davis
* @author Helena Shih
* @author Alan Liu
@ -484,13 +484,10 @@ public abstract class NumberFormat extends Format{
public static final int FORMAT_INTEGER = INTEGERSTYLE;
/**
* Return true if this factory will 'cover' other locales that
* are more specific than the ones in this factory. E.g., if
* this 'covers' other locales, then by supporting the 'en'
* locale, this also supports 'en_US', 'en_US_ETC' and so on,
* even though only the 'en' locale is listed.
*/
public abstract boolean covers();
* Return true if this factory will be visible. Default is true. */
public boolean visible() {
return true;
}
/**
* Return an unmodifiable collection of the locale names directly
@ -508,15 +505,19 @@ public abstract class NumberFormat extends Format{
public static abstract class SimpleNumberFormatFactory extends NumberFormatFactory {
final Set localeNames;
final boolean covers;
final boolean visible;
public SimpleNumberFormatFactory(Locale locale, boolean covers) {
public SimpleNumberFormatFactory(Locale locale) {
this(locale, true);
}
public SimpleNumberFormatFactory(Locale locale, boolean visible) {
localeNames = Collections.singleton(LocaleUtility.canonicalLocaleString(locale));
this.covers = covers;
this.visible = visible;
}
public final boolean covers() {
return covers;
public final boolean visible() {
return visible;
}
public final Set getSupportedLocaleNames() {
@ -528,7 +529,7 @@ public abstract class NumberFormat extends Format{
private NumberFormatFactory delegate;
NFFactory(NumberFormatFactory delegate) {
super(delegate.covers() ? VISIBLE_COVERS : VISIBLE);
super(delegate.visible() ? VISIBLE : INVISIBLE);
this.delegate = delegate;
}

View File

@ -632,7 +632,7 @@ import java.util.Set;
* @see GregorianCalendar
* @see TimeZone
* @see DateFormat
* @version $Revision: 1.32 $ $Date: 2002/10/04 19:41:03 $
* @version $Revision: 1.33 $ $Date: 2002/10/04 19:49:10 $
* @author Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu, Laura Werner
* @since JDK1.1
*/
@ -1546,21 +1546,25 @@ public abstract class Calendar implements Serializable, Cloneable {
}
/**
* Registers a default CalendarFactory for the provided locale.
* If covers is true, this factory is also used for all locales
* that are more specific than the provided locale. The returned
* object is a key that can be used to unregister this
* CalendarFactory. If the factory has not already been
* registered with registerFactory, it will be.
* Convenience override of register(CalendarFactory, Locale, boolean);
*/
public static Object register(CalendarFactory factory, Locale locale, boolean covers) {
public static Object register(CalendarFactory factory, Locale locale) {
return register(factory, locale, true);
}
/**
* Registers a default CalendarFactory for the provided locale.
* If the factory has not already been registered with
* registerFactory, it will be.
*/
public static Object register(CalendarFactory factory, Locale locale, boolean visible) {
if (factory == null) {
throw new IllegalArgumentException("calendar must not be null");
}
registerFactory(factory);
return getService().registerObject(factory, locale, covers
? LocaleKeyFactory.VISIBLE_COVERS
: LocaleKeyFactory.VISIBLE);
return getService().registerObject(factory, locale, visible
? LocaleKeyFactory.VISIBLE
: LocaleKeyFactory.INVISIBLE);
}
/**