76 lines
2.5 KiB
Java
76 lines
2.5 KiB
Java
/* GENERATED SOURCE. DO NOT MODIFY. */
|
|
// © 2016 and later: Unicode, Inc. and others.
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
|
/**
|
|
*******************************************************************************
|
|
* Copyright (C) 2001-2011, International Business Machines Corporation and *
|
|
* others. All Rights Reserved. *
|
|
*******************************************************************************
|
|
*/
|
|
|
|
package android.icu.util;
|
|
|
|
import java.util.Locale;
|
|
|
|
import android.icu.impl.ICULocaleService;
|
|
import android.icu.impl.ICUResourceBundle;
|
|
import android.icu.impl.ICUService;
|
|
import android.icu.impl.ICUService.Factory;
|
|
|
|
/**
|
|
* This is a package-access implementation of registration for
|
|
* currency. The shim is instantiated by reflection in Currency, all
|
|
* dependencies on ICUService are located in this file. This structure
|
|
* is to allow ICU4J to be built without service registration support.
|
|
*/
|
|
final class CurrencyServiceShim extends Currency.ServiceShim {
|
|
|
|
Locale[] getAvailableLocales() {
|
|
if (service.isDefault()) {
|
|
return ICUResourceBundle.getAvailableLocales();
|
|
}
|
|
return service.getAvailableLocales();
|
|
}
|
|
|
|
ULocale[] getAvailableULocales() {
|
|
if (service.isDefault()) {
|
|
return ICUResourceBundle.getAvailableULocales();
|
|
}
|
|
return service.getAvailableULocales();
|
|
}
|
|
|
|
Currency createInstance(ULocale loc) {
|
|
// TODO: convert to ULocale when service switches over
|
|
|
|
if (service.isDefault()) {
|
|
return Currency.createCurrency(loc);
|
|
}
|
|
Currency curr = (Currency)service.get(loc);
|
|
return curr;
|
|
}
|
|
|
|
Object registerInstance(Currency currency, ULocale locale) {
|
|
return service.registerObject(currency, locale);
|
|
}
|
|
|
|
boolean unregister(Object registryKey) {
|
|
return service.unregisterFactory((Factory)registryKey);
|
|
}
|
|
|
|
private static class CFService extends ICULocaleService {
|
|
CFService() {
|
|
super("Currency");
|
|
|
|
class CurrencyFactory extends ICUResourceBundleFactory {
|
|
protected Object handleCreate(ULocale loc, int kind, ICUService srvc) {
|
|
return Currency.createCurrency(loc);
|
|
}
|
|
}
|
|
|
|
registerFactory(new CurrencyFactory());
|
|
markDefault();
|
|
}
|
|
}
|
|
static final ICULocaleService service = new CFService();
|
|
}
|