java.util.spi.CurrencyNameProvider Java Examples
The following examples show how to use
java.util.spi.CurrencyNameProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Currency.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #2
Source File: Currency.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #3
Source File: Currency.java From JDKSourceCode1.8 with MIT License | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #4
Source File: Currency.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #5
Source File: JRELocaleProviderAdapter.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Getter methods for java.util.spi.* providers */ @Override public CurrencyNameProvider getCurrencyNameProvider() { if (currencyNameProvider == null) { CurrencyNameProvider provider = AccessController.doPrivileged( (PrivilegedAction<CurrencyNameProvider>) () -> new CurrencyNameProviderImpl( getAdapterType(), getLanguageTagSet("CurrencyNames"))); synchronized (this) { if (currencyNameProvider == null) { currencyNameProvider = provider; } } } return currencyNameProvider; }
Example #6
Source File: Currency.java From Java8CN with Apache License 2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #7
Source File: Currency.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #8
Source File: Currency.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #9
Source File: Currency.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #10
Source File: JRELocaleProviderAdapter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Getter methods for java.util.spi.* providers */ @Override public CurrencyNameProvider getCurrencyNameProvider() { if (currencyNameProvider == null) { CurrencyNameProvider provider = AccessController.doPrivileged( (PrivilegedAction<CurrencyNameProvider>) () -> new CurrencyNameProviderImpl( getAdapterType(), getLanguageTagSet("CurrencyNames"))); synchronized (this) { if (currencyNameProvider == null) { currencyNameProvider = provider; } } } return currencyNameProvider; }
Example #11
Source File: Currency.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #12
Source File: Currency.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
public String getObject(CurrencyNameProvider currencyNameProvider, Locale locale, String key, Object... params) { assert params.length == 1; int type = (Integer)params[0]; switch(type) { case SYMBOL: return currencyNameProvider.getSymbol(key, locale); case DISPLAYNAME: return currencyNameProvider.getDisplayName(key, locale); default: assert false; // shouldn't happen } return null; }
Example #13
Source File: Currency.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }
Example #14
Source File: Currency.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }
Example #15
Source File: Currency.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Gets the symbol of this currency for the specified locale. * For example, for the US Dollar, the symbol is "$" if the specified * locale is the US, while for other locales it may be "US$". If no * symbol can be determined, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the symbol of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null */ public String getSymbol(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String symbol = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, SYMBOL); if (symbol != null) { return symbol; } // use currency code as symbol of last resort return currencyCode; }
Example #16
Source File: Currency.java From Java8CN with Apache License 2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }
Example #17
Source File: Currency.java From Java8CN with Apache License 2.0 | 5 votes |
/** * Gets the symbol of this currency for the specified locale. * For example, for the US Dollar, the symbol is "$" if the specified * locale is the US, while for other locales it may be "US$". If no * symbol can be determined, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the symbol of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null */ public String getSymbol(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String symbol = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, SYMBOL); if (symbol != null) { return symbol; } // use currency code as symbol of last resort return currencyCode; }
Example #18
Source File: Currency.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }
Example #19
Source File: Currency.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
/** * Gets the symbol of this currency for the specified locale. * For example, for the US Dollar, the symbol is "$" if the specified * locale is the US, while for other locales it may be "US$". If no * symbol can be determined, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the symbol of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null */ public String getSymbol(Locale locale) { try { // Check whether a provider can provide an implementation that's closer // to the requested locale than what the Java runtime itself can provide. LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); if (pool.hasProviders()) { // Assuming that all the country locales include necessary currency // symbols in the Java runtime's resources, so there is no need to // examine whether Java runtime's currency resource bundle is missing // names. Therefore, no resource bundle is provided for calling this // method. String symbol = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, (OpenListResourceBundle)null, currencyCode, SYMBOL); if (symbol != null) { return symbol; } } ResourceBundle bundle = LocaleData.getCurrencyNames(locale); return bundle.getString(currencyCode); } catch (MissingResourceException e) { // use currency code as symbol of last resort return currencyCode; } }
Example #20
Source File: Currency.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Gets the symbol of this currency for the specified locale. * For example, for the US Dollar, the symbol is "$" if the specified * locale is the US, while for other locales it may be "US$". If no * symbol can be determined, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the symbol of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null */ public String getSymbol(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String symbol = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, SYMBOL); if (symbol != null) { return symbol; } // use currency code as symbol of last resort return currencyCode; }
Example #21
Source File: Currency.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }
Example #22
Source File: JRELocaleProviderAdapter.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Getter methods for java.util.spi.* providers */ @Override public CurrencyNameProvider getCurrencyNameProvider() { if (currencyNameProvider == null) { CurrencyNameProvider provider = new CurrencyNameProviderImpl(getAdapterType(), getLanguageTagSet("CurrencyNames")); synchronized (this) { if (currencyNameProvider == null) { currencyNameProvider = provider; } } } return currencyNameProvider; }
Example #23
Source File: JRELocaleProviderAdapter.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Getter methods for java.util.spi.* providers */ @Override public CurrencyNameProvider getCurrencyNameProvider() { if (currencyNameProvider == null) { CurrencyNameProvider provider = new CurrencyNameProviderImpl(getAdapterType(), getLanguageTagSet("CurrencyNames")); synchronized (this) { if (currencyNameProvider == null) { currencyNameProvider = provider; } } } return currencyNameProvider; }
Example #24
Source File: Currency.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }
Example #25
Source File: Currency.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @throws NullPointerException if {@code locale} is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }
Example #26
Source File: Currency.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Gets the symbol of this currency for the specified locale. * For example, for the US Dollar, the symbol is "$" if the specified * locale is the US, while for other locales it may be "US$". If no * symbol can be determined, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the symbol of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null */ public String getSymbol(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String symbol = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, SYMBOL); if (symbol != null) { return symbol; } // use currency code as symbol of last resort return currencyCode; }
Example #27
Source File: Currency.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Gets the symbol of this currency for the specified locale. * For example, for the US Dollar, the symbol is "$" if the specified * locale is the US, while for other locales it may be "US$". If no * symbol can be determined, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the symbol of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null */ public String getSymbol(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String symbol = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, SYMBOL); if (symbol != null) { return symbol; } // use currency code as symbol of last resort return currencyCode; }
Example #28
Source File: Currency.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Gets the symbol of this currency for the specified locale. * For example, for the US Dollar, the symbol is "$" if the specified * locale is the US, while for other locales it may be "US$". If no * symbol can be determined, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the symbol of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null */ public String getSymbol(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String symbol = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, SYMBOL); if (symbol != null) { return symbol; } // use currency code as symbol of last resort return currencyCode; }
Example #29
Source File: JRELocaleProviderAdapter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Getter methods for java.util.spi.* providers */ @Override public CurrencyNameProvider getCurrencyNameProvider() { if (currencyNameProvider == null) { CurrencyNameProvider provider = new CurrencyNameProviderImpl(getAdapterType(), getLanguageTagSet("CurrencyNames")); synchronized (this) { if (currencyNameProvider == null) { currencyNameProvider = provider; } } } return currencyNameProvider; }
Example #30
Source File: Currency.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Gets the name that is suitable for displaying this currency for * the specified locale. If there is no suitable display name found * for the specified locale, the ISO 4217 currency code is returned. * * @param locale the locale for which a display name for this currency is * needed * @return the display name of this currency for the specified locale * @exception NullPointerException if <code>locale</code> is null * @since 1.7 */ public String getDisplayName(Locale locale) { LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CurrencyNameProvider.class); String result = pool.getLocalizedObject( CurrencyNameGetter.INSTANCE, locale, currencyCode, DISPLAYNAME); if (result != null) { return result; } // use currency code as symbol of last resort return currencyCode; }