Hi,

I am continuing the series of patches with that one, it adds two methods to NumberFormat: getIntegerInstance() and getIntegerInstance(Locale). They have to be implemented according to Java 1.4.

Please review it before I check it in.

Regards,
Guilhem.

Index: java/text/NumberFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/NumberFormat.java,v
retrieving revision 1.4
diff -u -r1.4 NumberFormat.java
--- java/text/NumberFormat.java 22 Jan 2002 22:27:01 -0000      1.4
+++ java/text/NumberFormat.java 21 Nov 2003 19:58:29 -0000
@@ -323,6 +415,34 @@
   public static NumberFormat getNumberInstance (Locale loc)
   {
     return computeInstance (loc, "numberFormat", "#,##0.###");
+  }
+
+  /**
+   * This method returns an integer formatting and parsing class for the
+   * default locale. This will be a concrete subclass of <code>NumberFormat</code>,
+   * but the actual class returned is dependent on the locale.
+   *
+   * @return An instance of an integer number formatter for the default locale.
+   */
+  public static final NumberFormat getIntegerInstance()
+  {
+    return getIntegerInstance (Locale.getDefault());
+  }
+
+  /**
+   * This method returns an integer formatting and parsing class for the
+   * default locale. This will be a concrete subclass of <code>NumberFormat</code>,
+   * but the actual class returned is dependent on the locale.
+   *
+   * @param locale the desired locale.
+   *
+   * @return An instance of an integer number formatter for the default locale.
+   */
+  public static NumberFormat getIntegerInstance(Locale locale)
+  {
+    NumberFormat format = computeInstance (locale, "numberFormat", "#,##0");
+    format.setParseIntegerOnly (true);
+    return format;
   }
 
   /**
_______________________________________________
Classpath mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/classpath

Reply via email to