This patch adds the remaining three SPIs and
connects them to our existing implementations.

Changelog:

2007-01-08  Andrew John Hughes  <[EMAIL PROTECTED]>

        * java/text/DateFormat.java:
        (computeInstance(int,int,Locale,boolean,boolean)):
        Throw an exception when locale info. is unavailable.
        (computeDefault(int,int,boolean,boolean)): New method.
        (getDateInstance(int,Locale)): Check providers.
        (getDateTimeInstance(int,int,Locale)): Likewise.
        (getTimeInstance(int,Locale)): Likewise.
        * java/text/DateFormatSymbols.java:
        Update documentation to match DecimalFormatSymbols.
        * java/text/DecimalFormatSymbols.java:
        (DecimalFormatSymbols(Locale)): Reordered.
        (getInstance()): Implemented.
        (getInstance(Locale)): Implemented.
        * java/text/NumberFormat.java:
        (computeInstance(Locale,String,String)):
        Throw an exception when locale info is unavailable.
        (getCurrencyInstance(Locale)): Check providers.
        (getIntegerInstance(Locale)): Likewise.
        (getNumberInstance(Locale)): Likewise.
        (getPercentInstance(Locale)): Likewise.
        * java/text/spi/DateFormatProvider.java: New file.
        * java/text/spi/DecimalFormatSymbolsProvider.java: Likewise.
        * java/text/spi/NumberFormatProvider.java: Likewise.

-- 
Andrew :-)

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: java/text/DateFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/DateFormat.java,v
retrieving revision 1.23
diff -u -3 -p -u -r1.23 DateFormat.java
--- java/text/DateFormat.java   19 Sep 2005 16:09:57 -0000      1.23
+++ java/text/DateFormat.java   8 Jan 2007 00:19:03 -0000
@@ -39,12 +39,17 @@ exception statement from your version. *
 
 package java.text;
 
+import gnu.java.locale.LocaleHelper;
+
+import java.text.spi.DateFormatProvider;
+
 import java.io.InvalidObjectException;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
+import java.util.ServiceLoader;
 import java.util.TimeZone;
 
 /**
@@ -550,17 +555,14 @@ public abstract class DateFormat extends
   private static DateFormat computeInstance (int dateStyle, int timeStyle,
                                              Locale loc, boolean use_date,
                                              boolean use_time)
+    throws MissingResourceException
   {
-    ResourceBundle res;
-    try
-      {
-       res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
-                                      loc, ClassLoader.getSystemClassLoader());
-      }
-    catch (MissingResourceException x)
-      {
-       res = null;
-      }
+    if (loc.equals(Locale.ROOT))
+      return computeDefault(dateStyle,timeStyle,use_date,use_time);
+
+    ResourceBundle res =
+      ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+                              loc, ClassLoader.getSystemClassLoader());
 
     String pattern = null;
     if (use_date)
@@ -642,6 +644,59 @@ public abstract class DateFormat extends
     return new SimpleDateFormat (pattern, loc);
   }
 
+  private static DateFormat computeDefault (int dateStyle, int timeStyle,
+                                           boolean use_date, boolean use_time)
+  {
+    String pattern = null;
+    if (use_date)
+      {
+       switch (dateStyle)
+         {
+         case FULL:
+           pattern = "EEEE MMMM d, yyyy G";
+           break;
+         case LONG:
+           pattern = "MMMM d, yyyy";
+           break;
+         case MEDIUM:
+           pattern = "d-MMM-yy";
+           break;
+         case SHORT:
+           pattern = "M/d/yy";
+         default:
+           throw new IllegalArgumentException ();
+         }
+      }
+    
+    if (use_time)
+      {
+       if (pattern == null)
+         pattern = "";
+       else
+         pattern += " ";
+
+       switch (timeStyle)
+         {
+         case FULL:
+           pattern += "h:mm:ss;S 'o''clock' a z";
+           break;
+         case LONG:
+           pattern += "h:mm:ss a z";
+           break;
+         case MEDIUM:
+           pattern += "h:mm:ss a";
+           break;
+         case SHORT:
+           pattern += "h:mm a";
+           break;
+         default:
+           throw new IllegalArgumentException ();
+         }
+      }
+
+    return new SimpleDateFormat (pattern, Locale.ROOT);
+  }
+
  /**
    * This method returns an instance of <code>DateFormat</code> that will
    * format using the default formatting style for dates.
@@ -678,7 +733,29 @@ public abstract class DateFormat extends
    */
   public static final DateFormat getDateInstance (int style, Locale loc)
   {
-    return computeInstance (style, loc, true, false);
+    try
+      {
+       return computeInstance (style, loc, true, false);
+      }
+    catch (MissingResourceException e)
+      {
+       for (DateFormatProvider p :
+              ServiceLoader.load(DateFormatProvider.class))
+         {
+           for (Locale l : p.getAvailableLocales())
+             {
+               if (l.equals(loc))
+                 {
+                   DateFormat df = p.getDateInstance(style, loc);
+                   if (df != null)
+                     return df;
+                   break;
+                 }
+             }
+         }
+       return getDateInstance(style,
+                              LocaleHelper.getFallbackLocale(loc));
+      }
   }
 
   /**
@@ -717,7 +794,30 @@ public abstract class DateFormat extends
                                                      int timeStyle, 
                                                      Locale loc)
   {
-    return computeInstance (dateStyle, timeStyle, loc, true, true);
+    try
+      {
+       return computeInstance (dateStyle, timeStyle, loc, true, true);
+      }
+    catch (MissingResourceException e)
+      {
+       for (DateFormatProvider p :
+              ServiceLoader.load(DateFormatProvider.class))
+         {
+           for (Locale l : p.getAvailableLocales())
+             {
+               if (l.equals(loc))
+                 {
+                   DateFormat df = p.getDateTimeInstance(dateStyle,
+                                                         timeStyle, loc);
+                   if (df != null)
+                     return df;
+                   break;
+                 }
+             }
+         }
+       return getDateTimeInstance(dateStyle, timeStyle,
+                                  LocaleHelper.getFallbackLocale(loc));
+      }
   }
 
   /**
@@ -779,7 +879,29 @@ public abstract class DateFormat extends
    */
   public static final DateFormat getTimeInstance (int style, Locale loc)
   {
-    return computeInstance (style, loc, false, true);
+    try
+      {
+       return computeInstance (style, loc, false, true);
+      }
+    catch (MissingResourceException e)
+      {
+       for (DateFormatProvider p :
+              ServiceLoader.load(DateFormatProvider.class))
+         {
+           for (Locale l : p.getAvailableLocales())
+             {
+               if (l.equals(loc))
+                 {
+                   DateFormat df = p.getTimeInstance(style, loc);
+                   if (df != null)
+                     return df;
+                   break;
+                 }
+             }
+         }
+       return getTimeInstance(style,
+                              LocaleHelper.getFallbackLocale(loc));
+      }
   }
 
   /**
Index: java/text/DateFormatSymbols.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/DateFormatSymbols.java,v
retrieving revision 1.22
diff -u -3 -p -u -r1.22 DateFormatSymbols.java
--- java/text/DateFormatSymbols.java    3 Jan 2007 00:57:14 -0000       1.22
+++ java/text/DateFormatSymbols.java    8 Jan 2007 00:19:03 -0000
@@ -167,12 +167,13 @@ public class DateFormatSymbols implement
    * by loading the date format information for the specified locale.
    * This constructor only obtains instances using the runtime's resources;
    * to also include [EMAIL PROTECTED] 
java.text.spi.DateFormatSymbolsProvider} instances,
-   * call [EMAIL PROTECTED] #getInstance(Locale)} instead.
+   * call [EMAIL PROTECTED] #getInstance(java.util.Locale)} instead.
    *
    * @param locale The locale for which date formatting symbols should
    *               be loaded. 
    * @throws MissingResourceException if the resources for the specified
    *                                  locale could not be found or loaded.
+   * @see #getInstance(java.util.Locale)
    */
   public DateFormatSymbols (Locale locale)
     throws MissingResourceException
@@ -195,10 +196,13 @@ public class DateFormatSymbols implement
 
   /**
    * This method loads the format symbol information for the default
-   * locale.
+   * locale. This constructor only obtains instances using the runtime's 
resources;
+   * to also include [EMAIL PROTECTED] 
java.text.spi.DateFormatSymbolsProvider} instances,
+   * call [EMAIL PROTECTED] #getInstance()} instead.
    *
    * @throws MissingResourceException if the resources for the default
    *                                  locale could not be found or loaded.
+   * @see #getInstance()
    */
   public DateFormatSymbols() 
     throws MissingResourceException
Index: java/text/DecimalFormatSymbols.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/DecimalFormatSymbols.java,v
retrieving revision 1.23
diff -u -3 -p -u -r1.23 DecimalFormatSymbols.java
--- java/text/DecimalFormatSymbols.java 11 Dec 2006 00:50:58 -0000      1.23
+++ java/text/DecimalFormatSymbols.java 8 Jan 2007 00:19:05 -0000
@@ -1,5 +1,5 @@
 /* DecimalFormatSymbols.java -- Format symbols used by DecimalFormat
-   Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2004, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,13 +38,19 @@ exception statement from your version. *
 
 package java.text;
 
+import gnu.java.locale.LocaleHelper;
+
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
+
+import java.text.spi.DecimalFormatSymbolsProvider;
+
 import java.util.Currency;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
+import java.util.ServiceLoader;
 
 /**
  * This class is a container for the symbols used by 
@@ -80,6 +86,11 @@ public class DecimalFormatSymbols implem
   /**
    * This method initializes a new instance of
    * <code>DecimalFormatSymbols</code> for the default locale.
+   * This constructor only obtains instances using the runtime's resources;
+   * to also include [EMAIL PROTECTED] 
java.text.spi.DateFormatSymbolsProvider} instances,
+   * call [EMAIL PROTECTED] #getInstance()} instead.
+   *
+   * @see #getInstance()
    */
   public DecimalFormatSymbols ()
   {
@@ -137,18 +148,19 @@ public class DecimalFormatSymbols implem
    * international currency symbol will be set to the strings "?"
    * and "XXX" respectively.  This generally happens with language
    * locales (those with no specified country), such as
-   * <code>Locale.ENGLISH</code>.
+   * <code>Locale.ENGLISH</code>.  This constructor only obtains
+   * instances using the runtime's resources; to also include
+   * [EMAIL PROTECTED] java.text.spi.DecimalFormatSymbolsProvider} instances,
+   * call [EMAIL PROTECTED] #getInstance(java.util.Locale)} instead.
    *
    * @param loc The local to load symbols for.
    * @throws NullPointerException if the locale is null.
+   * @see #getInstance(java.util.Locale)
    */
   public DecimalFormatSymbols (Locale loc)
   {
     ResourceBundle res;
 
-    currency = Currency.getInstance("XXX");
-    currencySymbol = "?";
-    intlCurrencySymbol = "XXX";
     try
       {
        res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
@@ -158,6 +170,9 @@ public class DecimalFormatSymbols implem
       {
        res = null;
       }
+    currency = Currency.getInstance("XXX");
+    currencySymbol = "?";
+    intlCurrencySymbol = "XXX";
     try
       {
        Currency localeCurrency = Currency.getInstance(loc);
@@ -684,4 +699,68 @@ public class DecimalFormatSymbols implem
 
     serialVersionOnStream = 2;
   }
+
+  /**
+   * Returns a [EMAIL PROTECTED] DecimalFormatSymbols} instance for the
+   * default locale obtained from either the runtime itself
+   * or one of the installed
+   * [EMAIL PROTECTED] java.text.spi.DecimalFormatSymbolsProvider} instances.
+   * This is equivalent to calling
+   * <code>getInstance(Locale.getDefault())</code>.
+   * 
+   * @return a [EMAIL PROTECTED] DecimalFormatSymbols} instance for the default
+   *         locale.
+   * @since 1.6
+   */
+  public static final DecimalFormatSymbols getInstance()
+  {
+    return getInstance(Locale.getDefault());
+  }
+
+  /**
+   * Returns a [EMAIL PROTECTED] DecimalFormatSymbols} instance for the
+   * specified locale obtained from either the runtime itself
+   * or one of the installed
+   * [EMAIL PROTECTED] java.text.spi.DecimalFormatSymbolsProvider} instances.
+   * 
+   * @param locale the locale for which an instance should be
+   *               returned.
+   * @return a [EMAIL PROTECTED] DecimalFormatSymbols} instance for the 
specified
+   *         locale.
+   * @throws NullPointerException if <code>locale</code> is
+   *                              <code>null</code>.
+   * @since 1.6
+   */
+  public static final DecimalFormatSymbols getInstance(Locale locale)
+  {
+    try
+      {
+       if (!locale.equals(Locale.ROOT))
+         ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+                                  locale,
+                                  ClassLoader.getSystemClassLoader());
+       return new DecimalFormatSymbols(locale);        
+      }
+    catch (MissingResourceException x)
+      {
+       /* This means runtime support for the locale
+        * is not available, so we check providers. */
+      }
+    for (DecimalFormatSymbolsProvider p :
+          ServiceLoader.load(DecimalFormatSymbolsProvider.class))
+      {
+       for (Locale loc : p.getAvailableLocales())
+         {
+           if (loc.equals(locale))
+             {
+               DecimalFormatSymbols syms = p.getInstance(locale);
+               if (syms != null)
+                 return syms;
+               break;
+             }
+         }
+      }
+    return getInstance(LocaleHelper.getFallbackLocale(locale));
+  }
+
 }
Index: java/text/NumberFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/NumberFormat.java,v
retrieving revision 1.22
diff -u -3 -p -u -r1.22 NumberFormat.java
--- java/text/NumberFormat.java 10 Dec 2006 20:25:46 -0000      1.22
+++ java/text/NumberFormat.java 8 Jan 2007 00:19:05 -0000
@@ -1,5 +1,6 @@
 /* NumberFormat.java -- Formats and parses numbers
-   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, 
Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2007
+   Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,14 +39,20 @@ exception statement from your version. *
 
 package java.text;
 
+import gnu.java.locale.LocaleHelper;
+
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+
+import java.text.spi.NumberFormatProvider;
+
 import java.util.Currency;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
+import java.util.ServiceLoader;
 
 /**
  * This is the abstract superclass of all classes which format and 
@@ -309,17 +316,13 @@ public abstract class NumberFormat exten
 
   private static NumberFormat computeInstance(Locale loc, String resource,
                                               String def)
+    throws MissingResourceException
   {
-    ResourceBundle res;
-    try
-      {
-       res = ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
-               loc, ClassLoader.getSystemClassLoader());
-      }
-    catch (MissingResourceException x)
-      {
-       res = null;
-      }
+    if (loc.equals(Locale.ROOT))
+      return new DecimalFormat(def, DecimalFormatSymbols.getInstance(loc)); 
+    ResourceBundle res =
+      ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
+                              loc, ClassLoader.getSystemClassLoader());
     String fmt;
     try
       {
@@ -329,7 +332,7 @@ public abstract class NumberFormat exten
       {
        fmt = def;
       }
-    DecimalFormatSymbols dfs = new DecimalFormatSymbols (loc);
+    DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(loc);
     return new DecimalFormat (fmt, dfs);
   }
 
@@ -352,11 +355,33 @@ public abstract class NumberFormat exten
    */
   public static NumberFormat getCurrencyInstance (Locale loc)
   {
-    NumberFormat format;
-    
-    format = computeInstance (loc, "currencyFormat", 
"\u00A4#,##0.00;(\u00A4#,##0.00)");
-    
format.setMaximumFractionDigits(format.getCurrency().getDefaultFractionDigits());
  
-    return format;
+    try
+      {
+       NumberFormat format;
+       
+       format = computeInstance (loc, "currencyFormat",
+                                 "\u00A4#,##0.00;(\u00A4#,##0.00)");
+       
format.setMaximumFractionDigits(format.getCurrency().getDefaultFractionDigits());
  
+       return format;
+      }
+    catch (MissingResourceException e)
+      {
+       for (NumberFormatProvider p :
+              ServiceLoader.load(NumberFormatProvider.class))
+         {
+           for (Locale l : p.getAvailableLocales())
+             {
+               if (l.equals(loc))
+                 {
+                   NumberFormat nf = p.getCurrencyInstance(loc);
+                   if (nf != null)
+                     return nf;
+                   break;
+                 }
+             }
+         }
+       return getCurrencyInstance(LocaleHelper.getFallbackLocale(loc));
+      }
   }
 
   /**
@@ -456,7 +481,28 @@ public abstract class NumberFormat exten
    */
   public static NumberFormat getNumberInstance (Locale loc)
   {
-    return computeInstance (loc, "numberFormat", "#,##0.###");
+    try
+      {
+       return computeInstance (loc, "numberFormat", "#,##0.###");
+      }
+    catch (MissingResourceException e)
+      {
+       for (NumberFormatProvider p :
+              ServiceLoader.load(NumberFormatProvider.class))
+         {
+           for (Locale l : p.getAvailableLocales())
+             {
+               if (l.equals(loc))
+                 {
+                   NumberFormat nf = p.getNumberInstance(loc);
+                   if (nf != null)
+                     return nf;
+                   break;
+                 }
+             }
+         }
+       return getNumberInstance(LocaleHelper.getFallbackLocale(loc));
+      }
   }
 
   /**
@@ -484,10 +530,32 @@ public abstract class NumberFormat exten
    */
   public static NumberFormat getIntegerInstance(Locale locale)
   {
-    NumberFormat format = computeInstance (locale, "integerFormat", "#,##0");
-    format.setMaximumFractionDigits(0);
-    format.setParseIntegerOnly (true);
-    return format;
+    try
+      {
+       NumberFormat format = computeInstance (locale,
+                                              "integerFormat", "#,##0");
+       format.setMaximumFractionDigits(0);
+       format.setParseIntegerOnly (true);
+       return format;
+      }
+    catch (MissingResourceException e)
+      {
+       for (NumberFormatProvider p :
+              ServiceLoader.load(NumberFormatProvider.class))
+         {
+           for (Locale l : p.getAvailableLocales())
+             {
+               if (l.equals(locale))
+                 {
+                   NumberFormat nf = p.getIntegerInstance(locale);
+                   if (nf != null)
+                     return nf;
+                   break;
+                 }
+             }
+         }
+       return getIntegerInstance(LocaleHelper.getFallbackLocale(locale));
+      }
   }
 
   /**
@@ -511,7 +579,28 @@ public abstract class NumberFormat exten
    */
   public static NumberFormat getPercentInstance (Locale loc)
   {
-    return computeInstance (loc, "percentFormat", "#,##0%");
+    try
+      {
+       return computeInstance (loc, "percentFormat", "#,##0%");
+      }
+    catch (MissingResourceException e)
+      {
+       for (NumberFormatProvider p :
+              ServiceLoader.load(NumberFormatProvider.class))
+         {
+           for (Locale l : p.getAvailableLocales())
+             {
+               if (l.equals(loc))
+                 {
+                   NumberFormat nf = p.getPercentInstance(loc);
+                   if (nf != null)
+                     return nf;
+                   break;
+                 }
+             }
+         }
+       return getPercentInstance(LocaleHelper.getFallbackLocale(loc));
+      }
   }
 
   /**
Index: java/text/spi/DateFormatProvider.java
===================================================================
RCS file: java/text/spi/DateFormatProvider.java
diff -N java/text/spi/DateFormatProvider.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/text/spi/DateFormatProvider.java       8 Jan 2007 00:19:05 -0000
@@ -0,0 +1,129 @@
+/* DateFormatProvider.java -- Providers of localized instances
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.text.spi;
+
+import java.text.DateFormat;
+
+import java.util.Locale;
+
+import java.util.spi.LocaleServiceProvider;
+
+/**
+ * A [EMAIL PROTECTED] DateFormatProvider} provides localized
+ * instances of [EMAIL PROTECTED] java.text.DateFormat}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.6
+ */
+public abstract class DateFormatProvider
+  extends LocaleServiceProvider
+{
+
+  /**
+   * Constructs a new [EMAIL PROTECTED] DateFormatProvider}.
+   * Provided for implicit invocation by subclasses.
+   */
+  protected DateFormatProvider()
+  {
+  }
+
+  /**
+   * Returns a [EMAIL PROTECTED] java.text.DateFormat} instance
+   * for formatting dates with the given style in the specified
+   * [EMAIL PROTECTED] java.util.Locale}.
+   *
+   * @param style the formatting style; one of [EMAIL PROTECTED] 
DateFormat#SHORT},
+   *              [EMAIL PROTECTED] DateFormat#MEDIUM}, [EMAIL PROTECTED] 
DateFormat#LONG}
+   *              or [EMAIL PROTECTED] DateFormat#FULL}.
+   * @param locale the desired locale.
+   * @return the localized instance for formatting dates.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if the style is invalid or
+   *                                  the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.DateFormat#getDateInstance(int,java.util.Locale)
+   */
+  public abstract DateFormat getDateInstance(int style,
+                                            Locale locale);
+
+  /**
+   * Returns a [EMAIL PROTECTED] java.text.DateFormat} instance
+   * for formatting dates and times with the given style in the
+   * specified [EMAIL PROTECTED] java.util.Locale}.
+   *
+   * @param dateStyle the date formatting style; one of
+   *              [EMAIL PROTECTED] DateFormat#SHORT}, [EMAIL PROTECTED] 
DateFormat#MEDIUM},
+   *              [EMAIL PROTECTED] DateFormat#LONG} or [EMAIL PROTECTED] 
DateFormat#FULL}.
+   * @param timeStyle the time formatting style; one of
+   *              [EMAIL PROTECTED] DateFormat#SHORT}, [EMAIL PROTECTED] 
DateFormat#MEDIUM},
+   *              [EMAIL PROTECTED] DateFormat#LONG} or [EMAIL PROTECTED] 
DateFormat#FULL}.
+   * @param locale the desired locale.
+   * @return the localized instance for formatting dates.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if either style is invalid or
+   *                                  the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.DateFormat#getDateInstance(java.util.Locale)
+   */
+  public abstract DateFormat getDateTimeInstance(int dateStyle,
+                                                int timeStyle,
+                                                Locale locale);
+
+  /**
+   * Returns a [EMAIL PROTECTED] java.text.DateFormat} instance
+   * for formatting times with the given style in the specified
+   * [EMAIL PROTECTED] java.util.Locale}.
+   *
+   * @param style the formatting style; one of [EMAIL PROTECTED] 
DateFormat#SHORT},
+   *              [EMAIL PROTECTED] DateFormat#MEDIUM}, [EMAIL PROTECTED] 
DateFormat#LONG}
+   *              or [EMAIL PROTECTED] DateFormat#FULL}.
+   * @param locale the desired locale.
+   * @return the localized instance for formatting times.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if the style is invalid or
+   *                                  the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.DateFormat#getTimeInstance(int,java.util.Locale)
+   */
+  public abstract DateFormat getTimeInstance(int style,
+                                            Locale locale);
+
+}
Index: java/text/spi/DecimalFormatSymbolsProvider.java
===================================================================
RCS file: java/text/spi/DecimalFormatSymbolsProvider.java
diff -N java/text/spi/DecimalFormatSymbolsProvider.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/text/spi/DecimalFormatSymbolsProvider.java     8 Jan 2007 00:19:05 
-0000
@@ -0,0 +1,79 @@
+/* DecimalFormatSymbolsProvider.java -- Providers of localized instances
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.text.spi;
+
+import java.text.DecimalFormatSymbols;
+
+import java.util.Locale;
+
+import java.util.spi.LocaleServiceProvider;
+
+/**
+ * A [EMAIL PROTECTED] DecimalFormatSymbolsProvider} provides localized
+ * instances of [EMAIL PROTECTED] java.text.DecimalFormatSymbols}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.6
+ */
+public abstract class DecimalFormatSymbolsProvider
+  extends LocaleServiceProvider
+{
+
+  /**
+   * Constructs a new [EMAIL PROTECTED] DecimalFormatSymbolsProvider}.
+   * Provided for implicit invocation by subclasses.
+   */
+  protected DecimalFormatSymbolsProvider()
+  {
+  }
+
+  /**
+   * Returns a [EMAIL PROTECTED] java.text.DecimalFormatSymbols} instance
+   * for the specified [EMAIL PROTECTED] java.util.Locale}.
+   *
+   * @param locale the locale to express the symbols in.
+   * @return the localized instance.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.DecimalFormatSymbols#getInstance(java.util.Locale)
+   */
+  public abstract DecimalFormatSymbols getInstance(Locale locale);
+
+}
Index: java/text/spi/NumberFormatProvider.java
===================================================================
RCS file: java/text/spi/NumberFormatProvider.java
diff -N java/text/spi/NumberFormatProvider.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ java/text/spi/NumberFormatProvider.java     8 Jan 2007 00:19:05 -0000
@@ -0,0 +1,129 @@
+/* NumberFormatProvider.java -- Providers of localized instances
+   Copyright (C) 2007 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.text.spi;
+
+import java.text.NumberFormat;
+
+import java.util.Locale;
+
+import java.util.spi.LocaleServiceProvider;
+
+/**
+ * A [EMAIL PROTECTED] NumberFormatProvider} provides localized
+ * instances of [EMAIL PROTECTED] java.text.NumberFormat}.
+ *
+ * @author Andrew John Hughes ([EMAIL PROTECTED])
+ * @since 1.6
+ */
+public abstract class NumberFormatProvider
+  extends LocaleServiceProvider
+{
+
+  /**
+   * Constructs a new [EMAIL PROTECTED] NumberFormatProvider}.
+   * Provided for implicit invocation by subclasses.
+   */
+  protected NumberFormatProvider()
+  {
+  }
+
+  /**
+   * Returns a [EMAIL PROTECTED] java.text.NumberFormat} instance
+   * for monetary values in the specified
+   * [EMAIL PROTECTED] java.util.Locale}.
+   *
+   * @param locale the desired locale.
+   * @return the localized instance for monetary values.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.NumberFormat#getCurrencyInstance(java.util.Locale)
+   */
+  public abstract NumberFormat getCurrencyInstance(Locale locale);
+
+  /**
+   * Returns a [EMAIL PROTECTED] java.text.NumberFormat} instance
+   * for integers in the specified [EMAIL PROTECTED] java.util.Locale}.
+   * The returned instance should be configured to round 
+   * floating point numbers to the nearest integer using
+   * [EMAIL PROTECTED] java.math.RoundingMode#HALF_EVEN} rounding,
+   * and to parse only the integer part of a number.
+   *
+   * @param locale the desired locale.
+   * @return the localized instance for integers.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.NumberFormat#getIntegerInstance(java.util.Locale)
+   * @see java.math.RoundingMode#HALF_EVEN
+   * @see java.text.NumberFormat#isParseIntegerOnly()
+   */
+  public abstract NumberFormat getIntegerInstance(Locale locale);
+
+  /**
+   * Returns a general-purpose [EMAIL PROTECTED] java.text.NumberFormat}
+   * instance in the specified [EMAIL PROTECTED] java.util.Locale}.
+   *
+   * @param locale the desired locale.
+   * @return a general-purpose localized instance.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.NumberFormat#getNumberInstance(java.util.Locale)
+   */
+  public abstract NumberFormat getNumberInstance(Locale locale);
+
+  /**
+   * Returns a [EMAIL PROTECTED] java.text.NumberFormat} instance
+   * for percentage values in the specified
+   * [EMAIL PROTECTED] java.util.Locale}.
+   *
+   * @param locale the desired locale.
+   * @return the localized instance for percentage values.
+   * @throws NullPointerException if the locale is null.
+   * @throws IllegalArgumentException if the locale is not one
+   *                                  returned by
+   *                                  [EMAIL PROTECTED] getAvailableLocales()}
+   * @see java.text.NumberFormat#getPercentInstance(java.util.Locale)
+   */
+  public abstract NumberFormat getPercentInstance(Locale locale);
+
+}

Attachment: signature.asc
Description: Digital signature

Reply via email to