Path: blob/master/src/java.base/share/classes/java/text/spi/DateFormatProvider.java
41159 views
/*1* Copyright (c) 2005, 2019, 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.DateFormat;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.DateFormat DateFormat} class.35*36* @since 1.637*/38public abstract class DateFormatProvider extends LocaleServiceProvider {3940/**41* Sole constructor. (For invocation by subclass constructors, typically42* implicit.)43*/44protected DateFormatProvider() {45}4647/**48* Returns a new {@code DateFormat} instance which formats time49* with the given formatting style for the specified locale.50* @param style the given formatting style. Either one of51* {@link java.text.DateFormat#SHORT DateFormat.SHORT},52* {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},53* {@link java.text.DateFormat#LONG DateFormat.LONG}, or54* {@link java.text.DateFormat#FULL DateFormat.FULL}.55* @param locale the desired locale.56* @throws IllegalArgumentException if {@code style} is invalid,57* or if {@code locale} isn't58* one of the locales returned from59* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()60* getAvailableLocales()}.61* @throws NullPointerException if {@code locale} is null62* @return a time formatter.63* @see java.text.DateFormat#getTimeInstance(int, java.util.Locale)64*/65public abstract DateFormat getTimeInstance(int style, Locale locale);6667/**68* Returns a new {@code DateFormat} instance which formats date69* with the given formatting style for the specified locale.70* @param style the given formatting style. Either one of71* {@link java.text.DateFormat#SHORT DateFormat.SHORT},72* {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},73* {@link java.text.DateFormat#LONG DateFormat.LONG}, or74* {@link java.text.DateFormat#FULL DateFormat.FULL}.75* @param locale the desired locale.76* @throws IllegalArgumentException if {@code style} is invalid,77* or if {@code locale} isn't78* one of the locales returned from79* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()80* getAvailableLocales()}.81* @throws NullPointerException if {@code locale} is null82* @return a date formatter.83* @see java.text.DateFormat#getDateInstance(int, java.util.Locale)84*/85public abstract DateFormat getDateInstance(int style, Locale locale);8687/**88* Returns a new {@code DateFormat} instance which formats date and time89* with the given formatting style for the specified locale.90* @param dateStyle the given date formatting style. Either one of91* {@link java.text.DateFormat#SHORT DateFormat.SHORT},92* {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},93* {@link java.text.DateFormat#LONG DateFormat.LONG}, or94* {@link java.text.DateFormat#FULL DateFormat.FULL}.95* @param timeStyle the given time formatting style. Either one of96* {@link java.text.DateFormat#SHORT DateFormat.SHORT},97* {@link java.text.DateFormat#MEDIUM DateFormat.MEDIUM},98* {@link java.text.DateFormat#LONG DateFormat.LONG}, or99* {@link java.text.DateFormat#FULL DateFormat.FULL}.100* @param locale the desired locale.101* @throws IllegalArgumentException if {@code dateStyle} or102* {@code timeStyle} is invalid,103* or if {@code locale} isn't104* one of the locales returned from105* {@link java.util.spi.LocaleServiceProvider#getAvailableLocales()106* getAvailableLocales()}.107* @throws NullPointerException if {@code locale} is null108* @return a date/time formatter.109* @see java.text.DateFormat#getDateTimeInstance(int, int, java.util.Locale)110*/111public abstract DateFormat112getDateTimeInstance(int dateStyle, int timeStyle, Locale locale);113}114115116