Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/text/spi/NumberFormatProvider.java
38918 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.text.spi;2627import java.text.NumberFormat;28import java.util.Locale;29import java.util.spi.LocaleServiceProvider;3031/**32* An abstract class for service providers that33* provide concrete implementations of the34* {@link java.text.NumberFormat NumberFormat} class.35*36* @since 1.637*/38public abstract class NumberFormatProvider extends LocaleServiceProvider {3940/**41* Sole constructor. (For invocation by subclass constructors, typically42* implicit.)43*/44protected NumberFormatProvider() {45}4647/**48* Returns a new <code>NumberFormat</code> instance which formats49* monetary values for the specified locale.50*51* @param locale the desired locale.52* @exception NullPointerException if <code>locale</code> is null53* @exception IllegalArgumentException if <code>locale</code> isn't54* one of the locales returned from55* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()56* getAvailableLocales()}.57* @return a currency formatter58* @see java.text.NumberFormat#getCurrencyInstance(java.util.Locale)59*/60public abstract NumberFormat getCurrencyInstance(Locale locale);6162/**63* Returns a new <code>NumberFormat</code> instance which formats64* integer values for the specified locale.65* The returned number format is configured to66* round floating point numbers to the nearest integer using67* half-even rounding (see {@link java.math.RoundingMode#HALF_EVEN HALF_EVEN})68* for formatting, and to parse only the integer part of69* an input string (see {@link70* java.text.NumberFormat#isParseIntegerOnly isParseIntegerOnly}).71*72* @param locale the desired locale73* @exception NullPointerException if <code>locale</code> is null74* @exception IllegalArgumentException if <code>locale</code> isn't75* one of the locales returned from76* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()77* getAvailableLocales()}.78* @return a number format for integer values79* @see java.text.NumberFormat#getIntegerInstance(java.util.Locale)80*/81public abstract NumberFormat getIntegerInstance(Locale locale);8283/**84* Returns a new general-purpose <code>NumberFormat</code> instance for85* the specified locale.86*87* @param locale the desired locale88* @exception NullPointerException if <code>locale</code> is null89* @exception IllegalArgumentException if <code>locale</code> isn't90* one of the locales returned from91* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()92* getAvailableLocales()}.93* @return a general-purpose number formatter94* @see java.text.NumberFormat#getNumberInstance(java.util.Locale)95*/96public abstract NumberFormat getNumberInstance(Locale locale);9798/**99* Returns a new <code>NumberFormat</code> instance which formats100* percentage values for the specified locale.101*102* @param locale the desired locale103* @exception NullPointerException if <code>locale</code> is null104* @exception IllegalArgumentException if <code>locale</code> isn't105* one of the locales returned from106* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()107* getAvailableLocales()}.108* @return a percent formatter109* @see java.text.NumberFormat#getPercentInstance(java.util.Locale)110*/111public abstract NumberFormat getPercentInstance(Locale locale);112}113114115