001 /*
002 * Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation. Sun designates this
008 * particular file as subject to the "Classpath" exception as provided
009 * by Sun in the LICENSE file that accompanied this code.
010 *
011 * This code is distributed in the hope that it will be useful, but WITHOUT
012 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014 * version 2 for more details (a copy is included in the LICENSE file that
015 * accompanied this code).
016 *
017 * You should have received a copy of the GNU General Public License version
018 * 2 along with this work; if not, write to the Free Software Foundation,
019 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020 *
021 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022 * CA 95054 USA or visit www.sun.com if you need additional information or
023 * have any questions.
024 */
025
026 package java.text.spi;
027
028 import java.text.NumberFormat;
029 import java.util.Locale;
030 import java.util.spi.LocaleServiceProvider;
031
032 /**
033 * An abstract class for service providers that
034 * provide concrete implementations of the
035 * {@link java.text.NumberFormat NumberFormat} class.
036 *
037 * @since 1.6
038 * @version @(#)NumberFormatProvider.java 1.8 07/05/05
039 */
040 public abstract class NumberFormatProvider extends
041 LocaleServiceProvider {
042
043 /**
044 * Sole constructor. (For invocation by subclass constructors, typically
045 * implicit.)
046 */
047 protected NumberFormatProvider() {
048 }
049
050 /**
051 * Returns a new <code>NumberFormat</code> instance which formats
052 * monetary values for the specified locale.
053 *
054 * @param locale the desired locale.
055 * @exception NullPointerException if <code>locale</code> is null
056 * @exception IllegalArgumentException if <code>locale</code> isn't
057 * one of the locales returned from
058 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
059 * getAvailableLocales()}.
060 * @return a currency formatter
061 * @see java.text.NumberFormat#getCurrencyInstance(java.util.Locale)
062 */
063 public abstract NumberFormat getCurrencyInstance(Locale locale);
064
065 /**
066 * Returns a new <code>NumberFormat</code> instance which formats
067 * integer values for the specified locale.
068 * The returned number format is configured to
069 * round floating point numbers to the nearest integer using
070 * half-even rounding (see {@link java.math.RoundingMode#HALF_EVEN HALF_EVEN})
071 * for formatting, and to parse only the integer part of
072 * an input string (see {@link
073 * java.text.NumberFormat#isParseIntegerOnly isParseIntegerOnly}).
074 *
075 * @param locale the desired locale
076 * @exception NullPointerException if <code>locale</code> is null
077 * @exception IllegalArgumentException if <code>locale</code> isn't
078 * one of the locales returned from
079 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
080 * getAvailableLocales()}.
081 * @return a number format for integer values
082 * @see java.text.NumberFormat#getIntegerInstance(java.util.Locale)
083 */
084 public abstract NumberFormat getIntegerInstance(Locale locale);
085
086 /**
087 * Returns a new general-purpose <code>NumberFormat</code> instance for
088 * the specified locale.
089 *
090 * @param locale the desired locale
091 * @exception NullPointerException if <code>locale</code> is null
092 * @exception IllegalArgumentException if <code>locale</code> isn't
093 * one of the locales returned from
094 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
095 * getAvailableLocales()}.
096 * @return a general-purpose number formatter
097 * @see java.text.NumberFormat#getNumberInstance(java.util.Locale)
098 */
099 public abstract NumberFormat getNumberInstance(Locale locale);
100
101 /**
102 * Returns a new <code>NumberFormat</code> instance which formats
103 * percentage values for the specified locale.
104 *
105 * @param locale the desired locale
106 * @exception NullPointerException if <code>locale</code> is null
107 * @exception IllegalArgumentException if <code>locale</code> isn't
108 * one of the locales returned from
109 * {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()
110 * getAvailableLocales()}.
111 * @return a percent formatter
112 * @see java.text.NumberFormat#getPercentInstance(java.util.Locale)
113 */
114 public abstract NumberFormat getPercentInstance(Locale locale);
115 }
|