blob: 0a197b41af5d4f1f4e6257feff73508578d79be4 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package java.text.spi;
27
28import java.text.NumberFormat;
29import java.util.Locale;
30import java.util.spi.LocaleServiceProvider;
31
32/**
33 * An abstract class for service providers that
34 * provide concrete implementations of the
35 * {@link java.text.NumberFormat NumberFormat} class.
36 *
37 * @since 1.6
38 */
39public abstract class NumberFormatProvider extends LocaleServiceProvider {
40
41 /**
42 * Sole constructor. (For invocation by subclass constructors, typically
43 * implicit.)
44 */
45 protected NumberFormatProvider() {
46 }
47
48 /**
49 * Returns a new <code>NumberFormat</code> instance which formats
50 * monetary values for the specified locale.
51 *
52 * @param locale the desired locale.
53 * @exception NullPointerException if <code>locale</code> is null
54 * @exception IllegalArgumentException if <code>locale</code> isn't
55 * one of the locales returned from
56 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
57 * getAvailableLocales()}.
58 * @return a currency formatter
59 * @see java.text.NumberFormat#getCurrencyInstance(java.util.Locale)
60 */
61 public abstract NumberFormat getCurrencyInstance(Locale locale);
62
63 /**
64 * Returns a new <code>NumberFormat</code> instance which formats
65 * integer values for the specified locale.
66 * The returned number format is configured to
67 * round floating point numbers to the nearest integer using
68 * half-even rounding (see {@link java.math.RoundingMode#HALF_EVEN HALF_EVEN})
69 * for formatting, and to parse only the integer part of
70 * an input string (see {@link
71 * java.text.NumberFormat#isParseIntegerOnly isParseIntegerOnly}).
72 *
73 * @param locale the desired locale
74 * @exception NullPointerException if <code>locale</code> is null
75 * @exception IllegalArgumentException if <code>locale</code> isn't
76 * one of the locales returned from
77 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
78 * getAvailableLocales()}.
79 * @return a number format for integer values
80 * @see java.text.NumberFormat#getIntegerInstance(java.util.Locale)
81 */
82 public abstract NumberFormat getIntegerInstance(Locale locale);
83
84 /**
85 * Returns a new general-purpose <code>NumberFormat</code> instance for
86 * the specified locale.
87 *
88 * @param locale the desired locale
89 * @exception NullPointerException if <code>locale</code> is null
90 * @exception IllegalArgumentException if <code>locale</code> isn't
91 * one of the locales returned from
92 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
93 * getAvailableLocales()}.
94 * @return a general-purpose number formatter
95 * @see java.text.NumberFormat#getNumberInstance(java.util.Locale)
96 */
97 public abstract NumberFormat getNumberInstance(Locale locale);
98
99 /**
100 * Returns a new <code>NumberFormat</code> instance which formats
101 * percentage values for the specified locale.
102 *
103 * @param locale the desired locale
104 * @exception NullPointerException if <code>locale</code> is null
105 * @exception IllegalArgumentException if <code>locale</code> isn't
106 * one of the locales returned from
107 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
108 * getAvailableLocales()}.
109 * @return a percent formatter
110 * @see java.text.NumberFormat#getPercentInstance(java.util.Locale)
111 */
112 public abstract NumberFormat getPercentInstance(Locale locale);
113}