1c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes/*
2c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  Licensed to the Apache Software Foundation (ASF) under one or more
3c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  contributor license agreements.  See the NOTICE file distributed with
4c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  this work for additional information regarding copyright ownership.
5c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  The ASF licenses this file to You under the Apache License, Version 2.0
6c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  (the "License"); you may not use this file except in compliance with
7c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  the License.  You may obtain a copy of the License at
8c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *
9c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *     http://www.apache.org/licenses/LICENSE-2.0
10c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *
11c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  Unless required by applicable law or agreed to in writing, software
12c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  distributed under the License is distributed on an "AS IS" BASIS,
13c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  See the License for the specific language governing permissions and
15c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes *  limitations under the License.
16c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */
17c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes
18c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughespackage java.util.spi;
19c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes
20c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughesimport java.util.Locale;
21c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes
22c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes/**
23c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * This abstract class should be extended by service providers that provide
24c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * localized currency symbols (currency names) from currency codes.
25d2d7abef3e9b73a57cdf1f2afd678d7f48945679Elliott Hughes * <p>Note that Android does not support user-supplied locale service providers.
26c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @since 1.6
27c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes * @hide
28c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes */
29c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughespublic abstract class CurrencyNameProvider extends LocaleServiceProvider {
30c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes    /**
31c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     * Default constructor, for use by subclasses.
32c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     */
33c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes    protected CurrencyNameProvider() {
34c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes        // do nothing
35c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes    }
36c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes
37c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes    /**
38c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     * Returns the localized currency symbol for the given currency code.
39d2d7abef3e9b73a57cdf1f2afd678d7f48945679Elliott Hughes     *
40c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     * @param code an ISO 4217 currency code
41c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     * @param locale a locale
42c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     * @return the symbol or null if there is no available symbol in the locale
43c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     * @throws NullPointerException
44c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     *             if {@code code == null || locale == null}
45c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     * @throws IllegalArgumentException
46c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     *             if code or locale is not in a legal format or not available
47c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes     */
48c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes    public abstract String getSymbol(String code, Locale locale);
49c4a9c063cb234987b4dea66b5d1d26be8e754d0bElliott Hughes}
50