This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: java.text.NumberFormat


Hi list,


I wrote a little patch to add two missing methods to java.text.NumberFormat.

Please review and comment. Okay for commit ?


Michael
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2456
diff -u -b -B -r1.2456 ChangeLog
--- ChangeLog	18 Dec 2003 16:48:32 -0000	1.2456
+++ ChangeLog	18 Dec 2003 17:12:25 -0000
@@ -1,5 +1,12 @@
 2003-12-18  Michael Koch  <konqueror@gmx.de>
 
+	* java/text/NumberFormat.java: Sorted imports.
+	(getCurrency): New method.
+	(setCurrency): NEw method.
+	
+
+2003-12-18  Michael Koch  <konqueror@gmx.de>
+
 	* java/util/prefs/AbstractPreferences.java
 	(cachedChildren): New method.
 
Index: java/text/NumberFormat.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/text/NumberFormat.java,v
retrieving revision 1.10
diff -u -b -B -r1.10 NumberFormat.java
--- java/text/NumberFormat.java	27 Nov 2003 09:36:25 -0000	1.10
+++ java/text/NumberFormat.java	18 Dec 2003 17:12:29 -0000
@@ -38,13 +38,14 @@
 
 package java.text;
 
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
+import java.io.InvalidObjectException;
+import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.io.IOException;
-import java.io.InvalidObjectException;
+import java.util.Currency;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 
 /**
  * This is the abstract superclass of all classes which format and 
@@ -759,5 +760,45 @@
       (byte) minimumIntegerDigits : Byte.MAX_VALUE;
     serialVersionOnStream = 1;
     stream.defaultWriteObject();
+  }
+
+  /**
+   * Returns the currency used by this number format when formatting currency
+   * values.
+   *
+   * The default implementation throws UnsupportedOperationException.
+   *
+   * @return The used currency object, or null.
+   *
+   * @throws UnsupportedOperationException If the number format class doesn't
+   * implement currency formatting.
+   *
+   * @since 1.4
+   */
+  public Currency getCurrency()
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  /**
+   * Sets the currency used by this number format when formatting currency
+   * values.
+   *
+   * The default implementation throws UnsupportedOperationException.
+   *
+   * @param currency The new currency to be used by this number format.
+   *
+   * @throws NullPointerException If currenc is null.
+   * @throws UnsupportedOperationException If the number format class doesn't
+   * implement currency formatting.
+   *
+   * @since 1.4
+   */
+  public void setCurreny(Currency currency)
+  {
+    if (currency == null)
+      throw new NullPointerException("currency may not be null");
+    
+    throw new UnsupportedOperationException();
   }
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]