14
14
* A unit of currency.
15
15
* <p>
16
16
* This interface represents a unit of currency such as the British Pound, Euro,
17
- * US Dollar, Bitcoin or other. It is mainly defined to provide interoperability
17
+ * US Dollar, Bitcoin or other. It provides interoperability
18
18
* between different implementations.
19
19
* <p>
20
20
* Currencies can be distinguished by separate {@link #getCurrencyCode()} codes,
27
27
* <li>are required to be thread-safe
28
28
* <li>are required to be immutable
29
29
* <li>are required to be comparable
30
- * <li>are highly recommended to be serializable.
30
+ * <li>are required to be serializable.
31
31
* </ul>
32
32
*
33
33
* @author Werner Keil
@@ -52,9 +52,39 @@ public interface CurrencyUnit {
52
52
* @return the currency code, never {@code null}. For ISO-4217 this this
53
53
* will be the three letter ISO-4217 code. However, alternate
54
54
* currencies can have different codes. Also there is no constraint
55
- * about the formatting of alternate codes, despite they fact that
55
+ * about the formatting of alternate codes, despite the fact that
56
56
* the currency codes must be unique.
57
57
*/
58
58
public String getCurrencyCode ();
59
59
60
+ /**
61
+ * Gets a numeric currency code. within the ISO-4217 name space, this equals
62
+ * to the ISO numeric code. In other currency name spaces this number may be
63
+ * different, or even undefined (-1).
64
+ * <p>
65
+ * The numeric code is an optional alternative to the standard currency
66
+ * code. If defined, the numeric code is required to be unique.
67
+ * <p>
68
+ * This method matches the API of <type>java.util.Currency</type>.
69
+ *
70
+ * @return the numeric currency code
71
+ */
72
+ public int getNumericCode ();
73
+
74
+ /**
75
+ * Gets the number of fractional digits typically used by this currency.
76
+ * <p>
77
+ * Different currencies have different numbers of fractional digits by
78
+ * default. For example, 'GBP' has 2 fractional digits, but 'JPY' has zero.
79
+ * virtual currencies or those with no applicable fractional are indicated
80
+ * by -1.
81
+ * <p>
82
+ * This method matches the API of <type>java.util.Currency</type>.
83
+ *
84
+ * @return the fractional digits, from 0 to 9 (normally 0, 2 or 3), or 0 for
85
+ * pseudo-currencies.
86
+ *
87
+ */
88
+ public int getDefaultFractionDigits ();
89
+
60
90
}
0 commit comments