summaryrefslogtreecommitdiffstats
path: root/libjava/java/text/DecimalFormat.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/text/DecimalFormat.java')
-rw-r--r--libjava/java/text/DecimalFormat.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/libjava/java/text/DecimalFormat.java b/libjava/java/text/DecimalFormat.java
index 8dae1872fd3..359ad5591b0 100644
--- a/libjava/java/text/DecimalFormat.java
+++ b/libjava/java/text/DecimalFormat.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package java.text;
+import java.util.Currency;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
@@ -637,6 +638,19 @@ public class DecimalFormat extends NumberFormat
return dest;
}
+ /**
+ * Returns the currency corresponding to the currency symbol stored
+ * in the instance of <code>DecimalFormatSymbols</code> used by this
+ * <code>DecimalFormat</code>.
+ *
+ * @return A new instance of <code>Currency</code> if
+ * the currency code matches a known one, null otherwise.
+ */
+ public Currency getCurrency()
+ {
+ return symbols.getCurrency();
+ }
+
public DecimalFormatSymbols getDecimalFormatSymbols ()
{
return symbols;
@@ -856,6 +870,16 @@ public class DecimalFormat extends NumberFormat
return result;
}
+ /**
+ * Sets the <code>Currency</code> on the
+ * <code>DecimalFormatSymbols</code> used, which also sets the
+ * currency symbols on those symbols.
+ */
+ public void setCurrency(Currency currency)
+ {
+ symbols.setCurrency(currency);
+ }
+
public void setDecimalFormatSymbols (DecimalFormatSymbols newSymbols)
{
symbols = newSymbols;
OpenPOWER on IntegriCloud