8074411: Describe "minor unit" and/or "default fraction digits" in Currency class' javadoc clearly
authorpeytoia
Tue, 23 Feb 2016 17:09:46 +0900
changeset 36113 cd5af2894aee
parent 36112 e71e97060bf5
child 36114 a5ed9456c9be
8074411: Describe "minor unit" and/or "default fraction digits" in Currency class' javadoc clearly Reviewed-by: naoto, okutsu, peytoia Contributed-by: Nishit Jain <nishit.jain@oracle.com>
jdk/src/java.base/share/classes/java/util/Currency.java
--- a/jdk/src/java.base/share/classes/java/util/Currency.java	Tue Feb 23 07:17:54 2016 +0100
+++ b/jdk/src/java.base/share/classes/java/util/Currency.java	Tue Feb 23 17:09:46 2016 +0900
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,12 @@
  * and the remainder of entries in file are processed. For instances where duplicate
  * country code entries exist, the behavior of the Currency information for that
  * {@code Currency} is undefined and the remainder of entries in file are processed.
+ * <p>
+ * It is recommended to use {@link java.math.BigDecimal} class while dealing
+ * with {@code Currency} or monetary values as it provides better handling of floating
+ * point numbers and their operations.
  *
+ * @see java.math.BigDecimal
  * @since 1.4
  */
 public final class Currency implements Serializable {
@@ -516,14 +521,16 @@
     }
 
     /**
-     * Gets the default number of fraction digits used with this currency.
-     * For example, the default number of fraction digits for the Euro is 2,
-     * while for the Japanese Yen it's 0.
-     * In the case of pseudo-currencies, such as IMF Special Drawing Rights,
-     * -1 is returned.
-     *
-     * @return the default number of fraction digits used with this currency
-     */
+    * Gets the default number of fraction digits used with this currency.
+    * Note that the number of fraction digits is the same as ISO 4217's
+    * minor unit for the currency.
+    * For example, the default number of fraction digits for the Euro is 2,
+    * while for the Japanese Yen it's 0.
+    * In the case of pseudo-currencies, such as IMF Special Drawing Rights,
+    * -1 is returned.
+    *
+    * @return the default number of fraction digits used with this currency
+    */
     public int getDefaultFractionDigits() {
         return defaultFractionDigits;
     }