KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > text > spi > NumberFormatProvider


1 /*
2  * @(#)NumberFormatProvider.java 1.2 05/11/17
3  *
4  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.text.spi;
9
10 import java.text.NumberFormat JavaDoc;
11 import java.util.Locale JavaDoc;
12 import java.util.spi.LocaleServiceProvider;
13
14 /**
15  * An abstract class for service providers that
16  * provide concrete implementations of the
17  * {@link java.text.NumberFormat NumberFormat} class.
18  *
19  * @since 1.6
20  * @version @(#)NumberFormatProvider.java 1.2 05/11/17
21  */

22 public abstract class NumberFormatProvider extends LocaleServiceProvider {
23
24     /**
25      * Sole constructor. (For invocation by subclass constructors, typically
26      * implicit.)
27      */

28     protected NumberFormatProvider() {
29     }
30
31     /**
32      * Returns a new <code>NumberFormat</code> instance which formats
33      * monetary values for the specified locale.
34      *
35      * @param locale the desired locale.
36      * @exception NullPointerException if <code>locale</code> is null
37      * @exception IllegalArgumentException if <code>locale</code> isn't
38      * one of the locales returned from
39      * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
40      * getAvailableLocales()}.
41      * @return a currency formatter
42      * @see java.text.NumberFormat#getCurrencyInstance(java.util.Locale)
43      */

44     public abstract NumberFormat JavaDoc getCurrencyInstance(Locale JavaDoc locale);
45
46     /**
47      * Returns a new <code>NumberFormat</code> instance which formats
48      * integer values for the specified locale.
49      * The returned number format is configured to
50      * round floating point numbers to the nearest integer using
51      * half-even rounding (see {@link java.math.RoundingMode#HALF_EVEN HALF_EVEN})
52      * for formatting, and to parse only the integer part of
53      * an input string (see {@link
54      * java.text.NumberFormat#isParseIntegerOnly isParseIntegerOnly}).
55      *
56      * @param locale the desired locale
57      * @exception NullPointerException if <code>locale</code> is null
58      * @exception IllegalArgumentException if <code>locale</code> isn't
59      * one of the locales returned from
60      * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
61      * getAvailableLocales()}.
62      * @return a number format for integer values
63      * @see java.text.NumberFormat#getIntegerInstance(java.util.Locale)
64      */

65     public abstract NumberFormat JavaDoc getIntegerInstance(Locale JavaDoc locale);
66
67     /**
68      * Returns a new general-purpose <code>NumberFormat</code> instance for
69      * the specified locale.
70      *
71      * @param locale the desired locale
72      * @exception NullPointerException if <code>locale</code> is null
73      * @exception IllegalArgumentException if <code>locale</code> isn't
74      * one of the locales returned from
75      * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
76      * getAvailableLocales()}.
77      * @return a general-purpose number formatter
78      * @see java.text.NumberFormat#getNumberInstance(java.util.Locale)
79      */

80     public abstract NumberFormat JavaDoc getNumberInstance(Locale JavaDoc locale);
81
82     /**
83      * Returns a new <code>NumberFormat</code> instance which formats
84      * percentage values for the specified locale.
85      *
86      * @param locale the desired locale
87      * @exception NullPointerException if <code>locale</code> is null
88      * @exception IllegalArgumentException if <code>locale</code> isn't
89      * one of the locales returned from
90      * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
91      * getAvailableLocales()}.
92      * @return a percent formatter
93      * @see java.text.NumberFormat#getPercentInstance(java.util.Locale)
94      */

95     public abstract NumberFormat JavaDoc getPercentInstance(Locale JavaDoc locale);
96 }
97
Popular Tags