[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Currency setter/getter methods for DateFormat
From: |
Dalibor Topic |
Subject: |
[PATCH] Currency setter/getter methods for DateFormat |
Date: |
Sat, 15 Nov 2003 19:12:02 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030312 |
Hi all,
attached you'll find another trivial patch from Guilhem & Jim that I
picked up during my re-syncing effort. Please review and check in.
Guilhem wrote the methods, Jim added the import statement to make things
compile in java/text/DecimalFormat.java, whike Guilhem wrote all of the
patch to java/text/DecimalFormatSymbols.java alone.
cheers,
dalibor topic
ChangeLog:
2003-11-15 Guilhem Lavaux <address@hidden>,
Jim Pick <address@hidden>
* java/text/DecimalFormat.java (getCurrency, setCurrency): New
methods.
2003-11-15 Guilhem Lavaux <address@hidden>
* java/text/DecimalFormatSymbols.java (getCurrency,
setCurrency): New methods.
Index: java/text/DecimalFormat.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/text/DecimalFormat.java,v
retrieving revision 1.10
diff -u -r1.10 DecimalFormat.java
--- java/text/DecimalFormat.java 25 Oct 2003 00:16:24 -0000 1.10
+++ java/text/DecimalFormat.java 15 Nov 2003 17:38:15 -0000
@@ -37,6 +37,7 @@
package java.text;
+import java.util.Currency;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -637,6 +638,11 @@
return dest;
}
+ public Currency getCurrency()
+ {
+ return symbols.getCurrency();
+ }
+
public DecimalFormatSymbols getDecimalFormatSymbols ()
{
return symbols;
@@ -854,6 +860,11 @@
pos.setIndex(index + suffix.length());
return result;
+ }
+
+ public void setCurrency(Currency currency)
+ {
+ symbols.setCurrency(currency);
}
public void setDecimalFormatSymbols (DecimalFormatSymbols newSymbols)
--- /var/tmp/PROJECTS/classpath//./java/text/DecimalFormatSymbols.java Tue Jan
22 23:27:01 2002
+++ java/text/DecimalFormatSymbols.java Mon Sep 1 17:46:50 2003
@@ -39,6 +39,7 @@
package java.text;
import java.io.Serializable;
+import java.util.Currency;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -195,6 +197,18 @@
}
/**
+ * Returns the currency corresponding to the currency symbol stored
+ * in the instance of <code>DecimalFormatSymbols</code>.
+ *
+ * @return A new instance of <code>Currency</code> if
+ * the currency code matches a known one.
+ */
+ public Currency getCurrency ()
+ {
+ return Currency.getInstance (currencySymbol);
+ }
+
+ /**
* This method returns the currency symbol in local format. For example,
* "$" for Canadian dollars.
*
@@ -354,6 +368,16 @@
}
/**
+ * This method sets the currency to the specified value.
+ *
+ * @param currency The new currency
+ */
+ public void setCurrency (Currency currency)
+ {
+ setCurrencySymbol (currency.getSymbol());
+ }
+
+ /**
* This method sets the currency symbol to the specified value.
*
* @param currencySymbol The new currency symbol
- [PATCH] Currency setter/getter methods for DateFormat,
Dalibor Topic <=