From 6fa8b2a2722fdd05f466a5886f72118edf88ef9e Mon Sep 17 00:00:00 2001 From: mkoch Date: Wed, 19 Nov 2003 12:06:38 +0000 Subject: 2003-11-19 Guilhem Lavaux Jim Pick * java/text/DecimalFormat.java (getCurrency, setCurrency): New methods. 2003-11-19 Guilhem Lavaux * java/text/DecimalFormatSymbols.java (getCurrency, setCurrency): New methods. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73735 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/text/DecimalFormatSymbols.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libjava/java/text/DecimalFormatSymbols.java') diff --git a/libjava/java/text/DecimalFormatSymbols.java b/libjava/java/text/DecimalFormatSymbols.java index 2c1d971a649..1cb8f4f1769 100644 --- a/libjava/java/text/DecimalFormatSymbols.java +++ b/libjava/java/text/DecimalFormatSymbols.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.text; import java.io.Serializable; +import java.util.Currency; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -194,6 +195,18 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable && zeroDigit == dfs.zeroDigit); } + /** + * Returns the currency corresponding to the currency symbol stored + * in the instance of DecimalFormatSymbols. + * + * @return A new instance of Currency 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. @@ -353,6 +366,16 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable return zeroDigit << 16 + groupingSeparator << 8 + decimalSeparator; } + /** + * 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. * -- cgit v1.2.1