| CurrencyNameProvider.java |
1 /*
2 * %W% %E%
3 *
4 * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
5 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6 */
7
8 package java.util.spi;
9
10 import java.util.Currency;
11 import java.util.Locale;
12
13 /**
14 * An abstract class for service providers that
15 * provide localized currency symbols for the
16 * {@link java.util.Currency Currency} class.
17 * Note that currency symbols are considered names when determining
18 * behaviors described in the
19 * {@link java.util.spi.LocaleServiceProvider LocaleServiceProvider}
20 * specification.
21 *
22 * @since 1.6
23 * @version %W% %E%
24 */
25 public abstract class CurrencyNameProvider extends LocaleServiceProvider {
26
27 /**
28 * Sole constructor. (For invocation by subclass constructors, typically
29 * implicit.)
30 */
31 protected CurrencyNameProvider() {
32 }
33
34 /**
35 * Gets the symbol of the given currency code for the specified locale.
36 * For example, for "USD" (US Dollar), the symbol is "$" if the specified
37 * locale is the US, while for other locales it may be "US$". If no
38 * symbol can be determined, null should be returned.
39 *
40 * @param currencyCode the ISO 4217 currency code, which
41 * consists of three upper-case letters between 'A' (U+0041) and
42 * 'Z' (U+005A)
43 * @param locale the desired locale
44 * @return the symbol of the given currency code for the specified locale, or null if
45 * the symbol is not available for the locale
46 * @exception NullPointerException if <code>currencyCode</code> or
47 * <code>locale</code> is null
48 * @exception IllegalArgumentException if <code>currencyCode</code> is not in
49 * the form of three upper-case letters, or <code>locale</code> isn't
50 * one of the locales returned from
51 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
52 * getAvailableLocales()}.
53 * @see java.util.Currency#getSymbol(java.util.Locale)
54 */
55 public abstract String getSymbol(String currencyCode, Locale locale);
56 }
57