jdk/src/java.base/share/classes/java/util/Currency.java
changeset 36113 cd5af2894aee
parent 32930 7616af8ec145
child 37815 0ecfe8f6500e
equal deleted inserted replaced
36112:e71e97060bf5 36113:cd5af2894aee
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    90  * <p>
    90  * <p>
    91  * Where syntactically malformed entries are encountered, the entry is ignored
    91  * Where syntactically malformed entries are encountered, the entry is ignored
    92  * and the remainder of entries in file are processed. For instances where duplicate
    92  * and the remainder of entries in file are processed. For instances where duplicate
    93  * country code entries exist, the behavior of the Currency information for that
    93  * country code entries exist, the behavior of the Currency information for that
    94  * {@code Currency} is undefined and the remainder of entries in file are processed.
    94  * {@code Currency} is undefined and the remainder of entries in file are processed.
       
    95  * <p>
       
    96  * It is recommended to use {@link java.math.BigDecimal} class while dealing
       
    97  * with {@code Currency} or monetary values as it provides better handling of floating
       
    98  * point numbers and their operations.
    95  *
    99  *
       
   100  * @see java.math.BigDecimal
    96  * @since 1.4
   101  * @since 1.4
    97  */
   102  */
    98 public final class Currency implements Serializable {
   103 public final class Currency implements Serializable {
    99 
   104 
   100     private static final long serialVersionUID = -158308464356906721L;
   105     private static final long serialVersionUID = -158308464356906721L;
   514         // use currency code as symbol of last resort
   519         // use currency code as symbol of last resort
   515         return currencyCode;
   520         return currencyCode;
   516     }
   521     }
   517 
   522 
   518     /**
   523     /**
   519      * Gets the default number of fraction digits used with this currency.
   524     * Gets the default number of fraction digits used with this currency.
   520      * For example, the default number of fraction digits for the Euro is 2,
   525     * Note that the number of fraction digits is the same as ISO 4217's
   521      * while for the Japanese Yen it's 0.
   526     * minor unit for the currency.
   522      * In the case of pseudo-currencies, such as IMF Special Drawing Rights,
   527     * For example, the default number of fraction digits for the Euro is 2,
   523      * -1 is returned.
   528     * while for the Japanese Yen it's 0.
   524      *
   529     * In the case of pseudo-currencies, such as IMF Special Drawing Rights,
   525      * @return the default number of fraction digits used with this currency
   530     * -1 is returned.
   526      */
   531     *
       
   532     * @return the default number of fraction digits used with this currency
       
   533     */
   527     public int getDefaultFractionDigits() {
   534     public int getDefaultFractionDigits() {
   528         return defaultFractionDigits;
   535         return defaultFractionDigits;
   529     }
   536     }
   530 
   537 
   531     /**
   538     /**