jdk/src/java.base/share/classes/java/text/DecimalFormatSymbols.java
author mli
Wed, 31 May 2017 19:54:16 -0700
changeset 45434 4582657c7260
parent 34774 03b4e6dc367b
permissions -rw-r--r--
8181082: class-level since tag issues in java.base & java.datatransfer module Reviewed-by: alanb, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
     2
 * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * (C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *   The original version of this source code and documentation is copyrighted
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * materials are provided under terms of a License Agreement between Taligent
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * and Sun. This technology is protected by multiple US and International
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * patents. This notice and attribution to Taligent may not be removed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *   Taligent is a registered trademark of Taligent, Inc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
package java.text;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.io.ObjectInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.io.Serializable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.text.spi.DecimalFormatSymbolsProvider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import java.util.Currency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
import java.util.Locale;
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
    47
import sun.util.locale.provider.LocaleProviderAdapter;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
    48
import sun.util.locale.provider.LocaleServiceProviderPool;
15260
7af2d7a87806 7162007: Clean up i18n related caches
naoto
parents: 14336
diff changeset
    49
import sun.util.locale.provider.ResourceBundleBasedAdapter;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * This class represents the set of symbols (such as the decimal separator,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * the grouping separator, and so on) needed by <code>DecimalFormat</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * to format numbers. <code>DecimalFormat</code> creates for itself an instance of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <code>DecimalFormatSymbols</code> from its locale data.  If you need to change any
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * of these symbols, you can get the <code>DecimalFormatSymbols</code> object from
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * your <code>DecimalFormat</code> and modify it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @see          java.util.Locale
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @see          DecimalFormat
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * @author       Mark Davis
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @author       Alan Liu
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 34774
diff changeset
    63
 * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
public class DecimalFormatSymbols implements Cloneable, Serializable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
16010
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
    69
     * Create a DecimalFormatSymbols object for the default
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
    70
     * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * This constructor can only construct instances for the locales
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * supported by the Java runtime environment, not for those
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * supported by installed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * implementations. For full locale coverage, use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * {@link #getInstance(Locale) getInstance} method.
16010
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
    77
     * <p>This is equivalent to calling
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
    78
     * {@link #DecimalFormatSymbols(Locale)
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
    79
     *     DecimalFormatSymbols(Locale.getDefault(Locale.Category.FORMAT))}.
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
    80
     * @see java.util.Locale#getDefault(java.util.Locale.Category)
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
    81
     * @see java.util.Locale.Category#FORMAT
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public DecimalFormatSymbols() {
6489
9e7015635425 4700857: RFE: separating user locale and user interface locale
naoto
parents: 5506
diff changeset
    84
        initialize( Locale.getDefault(Locale.Category.FORMAT) );
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Create a DecimalFormatSymbols object for the given locale.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * This constructor can only construct instances for the locales
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * supported by the Java runtime environment, not for those
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * supported by installed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * implementations. For full locale coverage, use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * {@link #getInstance(Locale) getInstance} method.
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
    95
     * If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
    96
     * for the numbering system, the instance is initialized with the specified numbering
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
    97
     * system if the JRE implementation supports it. For example,
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
    98
     * <pre>
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
    99
     * NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   100
     * </pre>
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   101
     * This may return a {@code NumberFormat} instance with the Thai numbering system,
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   102
     * instead of the Latin numbering system.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   104
     * @param locale the desired locale
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @exception NullPointerException if <code>locale</code> is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public DecimalFormatSymbols( Locale locale ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        initialize( locale );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * Returns an array of all locales for which the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * <code>getInstance</code> methods of this class can return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * localized instances.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * The returned array represents the union of locales supported by the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * runtime and by installed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * {@link java.text.spi.DecimalFormatSymbolsProvider DecimalFormatSymbolsProvider}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * implementations.  It must contain at least a <code>Locale</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * instance equal to {@link java.util.Locale#US Locale.US}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   121
     * @return an array of locales for which localized
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *         <code>DecimalFormatSymbols</code> instances are available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    public static Locale[] getAvailableLocales() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        LocaleServiceProviderPool pool =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
            LocaleServiceProviderPool.getPool(DecimalFormatSymbolsProvider.class);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        return pool.getAvailableLocales();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * Gets the <code>DecimalFormatSymbols</code> instance for the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * locale.  This method provides access to <code>DecimalFormatSymbols</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * instances for locales supported by the Java runtime itself as well
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * as for those supported by installed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * {@link java.text.spi.DecimalFormatSymbolsProvider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * DecimalFormatSymbolsProvider} implementations.
16010
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
   138
     * <p>This is equivalent to calling
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
   139
     * {@link #getInstance(Locale)
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
   140
     *     getInstance(Locale.getDefault(Locale.Category.FORMAT))}.
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
   141
     * @see java.util.Locale#getDefault(java.util.Locale.Category)
2727163b5df5 7092447: Clarify the default locale used in each locale sensitive operation
naoto
parents: 15260
diff changeset
   142
     * @see java.util.Locale.Category#FORMAT
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @return a <code>DecimalFormatSymbols</code> instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    public static final DecimalFormatSymbols getInstance() {
6489
9e7015635425 4700857: RFE: separating user locale and user interface locale
naoto
parents: 5506
diff changeset
   147
        return getInstance(Locale.getDefault(Locale.Category.FORMAT));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * Gets the <code>DecimalFormatSymbols</code> instance for the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * locale.  This method provides access to <code>DecimalFormatSymbols</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * instances for locales supported by the Java runtime itself as well
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * as for those supported by installed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * {@link java.text.spi.DecimalFormatSymbolsProvider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * DecimalFormatSymbolsProvider} implementations.
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   157
     * If the specified locale contains the {@link java.util.Locale#UNICODE_LOCALE_EXTENSION}
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   158
     * for the numbering system, the instance is initialized with the specified numbering
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   159
     * system if the JRE implementation supports it. For example,
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   160
     * <pre>
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   161
     * NumberFormat.getNumberInstance(Locale.forLanguageTag("th-TH-u-nu-thai"))
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   162
     * </pre>
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   163
     * This may return a {@code NumberFormat} instance with the Thai numbering system,
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   164
     * instead of the Latin numbering system.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   165
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @param locale the desired locale.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @return a <code>DecimalFormatSymbols</code> instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @exception NullPointerException if <code>locale</code> is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    public static final DecimalFormatSymbols getInstance(Locale locale) {
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   172
        LocaleProviderAdapter adapter;
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   173
        adapter = LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   174
        DecimalFormatSymbolsProvider provider = adapter.getDecimalFormatSymbolsProvider();
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   175
        DecimalFormatSymbols dfsyms = provider.getInstance(locale);
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   176
        if (dfsyms == null) {
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   177
            provider = LocaleProviderAdapter.forJRE().getDecimalFormatSymbolsProvider();
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   178
            dfsyms = provider.getInstance(locale);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        }
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   180
        return dfsyms;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * Gets the character used for zero. Different for Arabic, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   185
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   186
     * @return the character used for zero
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    public char getZeroDigit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        return zeroDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * Sets the character used for zero. Different for Arabic, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   194
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   195
     * @param zeroDigit the character used for zero
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    public void setZeroDigit(char zeroDigit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        this.zeroDigit = zeroDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * Gets the character used for thousands separator. Different for French, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   203
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   204
     * @return the grouping separator
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    public char getGroupingSeparator() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        return groupingSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * Sets the character used for thousands separator. Different for French, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   212
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   213
     * @param groupingSeparator the grouping separator
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    public void setGroupingSeparator(char groupingSeparator) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        this.groupingSeparator = groupingSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * Gets the character used for decimal sign. Different for French, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   221
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   222
     * @return the character used for decimal sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    public char getDecimalSeparator() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        return decimalSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * Sets the character used for decimal sign. Different for French, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   230
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   231
     * @param decimalSeparator the character used for decimal sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    public void setDecimalSeparator(char decimalSeparator) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        this.decimalSeparator = decimalSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * Gets the character used for per mille sign. Different for Arabic, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   239
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   240
     * @return the character used for per mille sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    public char getPerMill() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        return perMill;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * Sets the character used for per mille sign. Different for Arabic, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   248
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   249
     * @param perMill the character used for per mille sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    public void setPerMill(char perMill) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        this.perMill = perMill;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * Gets the character used for percent sign. Different for Arabic, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   257
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   258
     * @return the character used for percent sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    public char getPercent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        return percent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * Sets the character used for percent sign. Different for Arabic, etc.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   266
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   267
     * @param percent the character used for percent sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    public void setPercent(char percent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        this.percent = percent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * Gets the character used for a digit in a pattern.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   275
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   276
     * @return the character used for a digit in a pattern
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    public char getDigit() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        return digit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * Sets the character used for a digit in a pattern.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   284
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   285
     * @param digit the character used for a digit in a pattern
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    public void setDigit(char digit) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        this.digit = digit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * Gets the character used to separate positive and negative subpatterns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * in a pattern.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   294
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   295
     * @return the pattern separator
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    public char getPatternSeparator() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        return patternSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * Sets the character used to separate positive and negative subpatterns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * in a pattern.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   304
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   305
     * @param patternSeparator the pattern separator
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    public void setPatternSeparator(char patternSeparator) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        this.patternSeparator = patternSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * Gets the string used to represent infinity. Almost always left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * unchanged.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   314
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   315
     * @return the string representing infinity
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    public String getInfinity() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        return infinity;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * Sets the string used to represent infinity. Almost always left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * unchanged.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   324
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   325
     * @param infinity the string representing infinity
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    public void setInfinity(String infinity) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        this.infinity = infinity;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * Gets the string used to represent "not a number". Almost always left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * unchanged.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   334
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   335
     * @return the string representing "not a number"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    public String getNaN() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        return NaN;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * Sets the string used to represent "not a number". Almost always left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * unchanged.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   344
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   345
     * @param NaN the string representing "not a number"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    public void setNaN(String NaN) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
        this.NaN = NaN;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * Gets the character used to represent minus sign. If no explicit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * negative format is specified, one is formed by prefixing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * minusSign to the positive format.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   355
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   356
     * @return the character representing minus sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    public char getMinusSign() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        return minusSign;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * Sets the character used to represent minus sign. If no explicit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * negative format is specified, one is formed by prefixing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * minusSign to the positive format.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   366
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   367
     * @param minusSign the character representing minus sign
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    public void setMinusSign(char minusSign) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        this.minusSign = minusSign;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * Returns the currency symbol for the currency of these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * DecimalFormatSymbols in their locale.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   376
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   377
     * @return the currency symbol
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    public String getCurrencySymbol()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    {
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   382
        initializeCurrency(locale);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        return currencySymbol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * Sets the currency symbol for the currency of these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * DecimalFormatSymbols in their locale.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   389
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   390
     * @param currency the currency symbol
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    public void setCurrencySymbol(String currency)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    {
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   395
        initializeCurrency(locale);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        currencySymbol = currency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * Returns the ISO 4217 currency code of the currency of these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * DecimalFormatSymbols.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   402
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   403
     * @return the currency code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    public String getInternationalCurrencySymbol()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    {
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   408
        initializeCurrency(locale);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        return intlCurrencySymbol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * Sets the ISO 4217 currency code of the currency of these
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * DecimalFormatSymbols.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * If the currency code is valid (as defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * {@link java.util.Currency#getInstance(java.lang.String) Currency.getInstance}),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * this also sets the currency attribute to the corresponding Currency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * instance and the currency symbol attribute to the currency's symbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * in the DecimalFormatSymbols' locale. If the currency code is not valid,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * then the currency attribute is set to null and the currency symbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * attribute is not modified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     *
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   423
     * @param currencyCode the currency code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * @see #setCurrency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @see #setCurrencySymbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    public void setInternationalCurrencySymbol(String currencyCode)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    {
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   430
        initializeCurrency(locale);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        intlCurrencySymbol = currencyCode;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        currency = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        if (currencyCode != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                currency = Currency.getInstance(currencyCode);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                currencySymbol = currency.getSymbol();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            } catch (IllegalArgumentException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * Gets the currency of these DecimalFormatSymbols. May be null if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * currency symbol attribute was previously set to a value that's not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * a valid ISO 4217 currency code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * @return the currency used, or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    public Currency getCurrency() {
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   451
        initializeCurrency(locale);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        return currency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * Sets the currency of these DecimalFormatSymbols.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * This also sets the currency symbol attribute to the currency's symbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * in the DecimalFormatSymbols' locale, and the international currency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * symbol attribute to the currency's ISO 4217 currency code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @param currency the new currency to be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * @exception NullPointerException if <code>currency</code> is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * @see #setCurrencySymbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * @see #setInternationalCurrencySymbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    public void setCurrency(Currency currency) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        if (currency == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
            throw new NullPointerException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        }
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   471
        initializeCurrency(locale);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        this.currency = currency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        intlCurrencySymbol = currency.getCurrencyCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        currencySymbol = currency.getSymbol(locale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * Returns the monetary decimal separator.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   480
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   481
     * @return the monetary decimal separator
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    public char getMonetaryDecimalSeparator()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        return monetarySeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * Sets the monetary decimal separator.
19054
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   491
     *
a64012cb49d6 8021108: Clean up doclint warnings and errors in java.text package
peytoia
parents: 16010
diff changeset
   492
     * @param sep the monetary decimal separator
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    public void setMonetaryDecimalSeparator(char sep)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        monetarySeparator = sep;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
    //------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    // BEGIN   Package Private methods ... to be made public later
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    //------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * Returns the character used to separate the mantissa from the exponent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    char getExponentialSymbol()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        return exponential;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    }
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   511
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   512
    /**
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   513
     * Returns the string used to separate the mantissa from the exponent.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   514
     * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   515
     *
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   516
     * @return the exponent separator string
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   517
     * @see #setExponentSeparator(java.lang.String)
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   518
     * @since 1.6
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   519
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    public String getExponentSeparator()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        return exponentialSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     * Sets the character used to separate the mantissa from the exponent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    void setExponentialSymbol(char exp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        exponential = exp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   533
    /**
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   534
     * Sets the string used to separate the mantissa from the exponent.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   535
     * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   536
     *
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   537
     * @param exp the exponent separator string
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   538
     * @exception NullPointerException if <code>exp</code> is null
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   539
     * @see #getExponentSeparator()
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   540
     * @since 1.6
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   541
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    public void setExponentSeparator(String exp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
        if (exp == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
            throw new NullPointerException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        exponentialSeparator = exp;
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   548
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    //------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    // END     Package Private methods ... to be made public later
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    //------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * Standard override.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     */
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   558
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    public Object clone() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
            return (DecimalFormatSymbols)super.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
            // other fields are bit-copied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
        } catch (CloneNotSupportedException e) {
10419
12c063b39232 7084245: Update usages of InternalError to use exception chaining
sherman
parents: 6501
diff changeset
   564
            throw new InternalError(e);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     * Override equals.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     */
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   571
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    public boolean equals(Object obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
        if (obj == null) return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
        if (this == obj) return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        if (getClass() != obj.getClass()) return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
        DecimalFormatSymbols other = (DecimalFormatSymbols) obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
        return (zeroDigit == other.zeroDigit &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
        groupingSeparator == other.groupingSeparator &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
        decimalSeparator == other.decimalSeparator &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
        percent == other.percent &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
        perMill == other.perMill &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
        digit == other.digit &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
        minusSign == other.minusSign &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        patternSeparator == other.patternSeparator &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
        infinity.equals(other.infinity) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        NaN.equals(other.NaN) &&
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   587
        getCurrencySymbol().equals(other.getCurrencySymbol()) && // possible currency init occurs here
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
        intlCurrencySymbol.equals(other.intlCurrencySymbol) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
        currency == other.currency &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
        monetarySeparator == other.monetarySeparator &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
        exponentialSeparator.equals(other.exponentialSeparator) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
        locale.equals(other.locale));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * Override hashCode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     */
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   598
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
            int result = zeroDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
            result = result * 37 + groupingSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
            result = result * 37 + decimalSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
            return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * Initializes the symbols from the FormatData resource bundle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
    private void initialize( Locale locale ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
        this.locale = locale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
15260
7af2d7a87806 7162007: Clean up i18n related caches
naoto
parents: 14336
diff changeset
   612
        // get resource bundle data
7af2d7a87806 7162007: Clean up i18n related caches
naoto
parents: 14336
diff changeset
   613
        LocaleProviderAdapter adapter = LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
7af2d7a87806 7162007: Clean up i18n related caches
naoto
parents: 14336
diff changeset
   614
        // Avoid potential recursions
7af2d7a87806 7162007: Clean up i18n related caches
naoto
parents: 14336
diff changeset
   615
        if (!(adapter instanceof ResourceBundleBasedAdapter)) {
7af2d7a87806 7162007: Clean up i18n related caches
naoto
parents: 14336
diff changeset
   616
            adapter = LocaleProviderAdapter.getResourceBundleBased();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        }
15260
7af2d7a87806 7162007: Clean up i18n related caches
naoto
parents: 14336
diff changeset
   618
        Object[] data = adapter.getLocaleResources(locale).getDecimalFormatSymbolsData();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
        String[] numberElements = (String[]) data[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
        decimalSeparator = numberElements[0].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
        groupingSeparator = numberElements[1].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
        patternSeparator = numberElements[2].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
        percent = numberElements[3].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
        zeroDigit = numberElements[4].charAt(0); //different for Arabic,etc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        digit = numberElements[5].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        minusSign = numberElements[6].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
        exponential = numberElements[7].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        exponentialSeparator = numberElements[7]; //string representation new since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
        perMill = numberElements[8].charAt(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        infinity  = numberElements[9];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
        NaN = numberElements[10];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   634
        // maybe filled with previously cached values, or null.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   635
        intlCurrencySymbol = (String) data[1];
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   636
        currencySymbol = (String) data[2];
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   637
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   638
        // Currently the monetary decimal separator is the same as the
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   639
        // standard decimal separator for all locales that we support.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   640
        // If that changes, add a new entry to NumberElements.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   641
        monetarySeparator = decimalSeparator;
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   642
    }
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   643
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   644
    /**
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   645
     * Lazy initialization for currency related fields
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   646
     */
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   647
    private void initializeCurrency(Locale locale) {
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   648
        if (currencyInitialized) {
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   649
            return;
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   650
        }
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   651
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
        // Try to obtain the currency used in the locale's country.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
        // Check for empty country string separately because it's a valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
        // country ID for Locale (and used for the C locale), but not a valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
        // ISO 3166 country code, and exceptions are expensive.
13583
dc0017b1a452 6336885: RFE: Locale Data Deployment Enhancements
naoto
parents: 10419
diff changeset
   656
        if (locale.getCountry().length() > 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
                currency = Currency.getInstance(locale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
            } catch (IllegalArgumentException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
                // use default values below for compatibility
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
        }
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   663
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
        if (currency != null) {
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   665
            // get resource bundle data
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   666
            LocaleProviderAdapter adapter =
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   667
                LocaleProviderAdapter.getAdapter(DecimalFormatSymbolsProvider.class, locale);
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   668
            // Avoid potential recursions
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   669
            if (!(adapter instanceof ResourceBundleBasedAdapter)) {
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   670
                adapter = LocaleProviderAdapter.getResourceBundleBased();
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   671
            }
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   672
            Object[] data = adapter.getLocaleResources(locale).getDecimalFormatSymbolsData();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
            intlCurrencySymbol = currency.getCurrencyCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
            if (data[1] != null && data[1] == intlCurrencySymbol) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                currencySymbol = (String) data[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                currencySymbol = currency.getSymbol(locale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                data[1] = intlCurrencySymbol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                data[2] = currencySymbol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
            // default values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
            intlCurrencySymbol = "XXX";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                currency = Currency.getInstance(intlCurrencySymbol);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
            } catch (IllegalArgumentException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
            currencySymbol = "\u00A4";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
        }
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   690
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   691
        currencyInitialized = true;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * Reads the default serializable fields, provides default values for objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     * in older serial versions, and initializes non-serializable fields.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     * If <code>serialVersionOnStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * is less than 1, initializes <code>monetarySeparator</code> to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     * the same as <code>decimalSeparator</code> and <code>exponential</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     * to be 'E'.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
     * If <code>serialVersionOnStream</code> is less than 2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
     * initializes <code>locale</code>to the root locale, and initializes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     * If <code>serialVersionOnStream</code> is less than 3, it initializes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     * <code>exponentialSeparator</code> using <code>exponential</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * Sets <code>serialVersionOnStream</code> back to the maximum allowed value so that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * default serialization will work properly if this object is streamed out again.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * Initializes the currency from the intlCurrencySymbol field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     *
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 19054
diff changeset
   709
     * @since  1.1.6
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
    private void readObject(ObjectInputStream stream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
            throws IOException, ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
        stream.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
        if (serialVersionOnStream < 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
            // Didn't have monetarySeparator or exponential field;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
            // use defaults.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
            monetarySeparator = decimalSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
            exponential       = 'E';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
        if (serialVersionOnStream < 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
            // didn't have locale; use root locale
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
            locale = Locale.ROOT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
        if (serialVersionOnStream < 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
            // didn't have exponentialSeparator. Create one using exponential
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
            exponentialSeparator = Character.toString(exponential);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
        serialVersionOnStream = currentSerialVersion;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
        if (intlCurrencySymbol != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
                 currency = Currency.getInstance(intlCurrencySymbol);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
            } catch (IllegalArgumentException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
            }
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   735
            currencyInitialized = true;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * Character used for zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     * @see #getZeroDigit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
    private  char    zeroDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     * Character used for thousands separator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * @see #getGroupingSeparator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
    private  char    groupingSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * Character used for decimal sign.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * @see #getDecimalSeparator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
    private  char    decimalSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * Character used for per mille sign.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * @see #getPerMill
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
    private  char    perMill;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     * Character used for percent sign.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     * @see #getPercent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
    private  char    percent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * Character used for a digit in a pattern.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * @see #getDigit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
    private  char    digit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * Character used to separate positive and negative subpatterns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     * in a pattern.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     * @see #getPatternSeparator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
    private  char    patternSeparator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     * String used to represent infinity.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * @see #getInfinity
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
    private  String  infinity;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     * String used to represent "not a number".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * @see #getNaN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
    private  String  NaN;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     * Character used to represent minus sign.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     * @see #getMinusSign
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
    private  char    minusSign;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * String denoting the local currency, e.g. "$".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * @see #getCurrencySymbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
    private  String  currencySymbol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     * ISO 4217 currency code denoting the local currency, e.g. "USD".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     * @see #getInternationalCurrencySymbol
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
    private  String  intlCurrencySymbol;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     * The decimal separator used when formatting currency values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * @serial
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 19054
diff changeset
   833
     * @since  1.1.6
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * @see #getMonetaryDecimalSeparator
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
    private  char    monetarySeparator; // Field new in JDK 1.1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     * The character used to distinguish the exponent in a number formatted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * in exponential notation, e.g. 'E' for a number such as "1.23E45".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * Note that the public API provides no way to set this field,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * even though it is supported by the implementation and the stream format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * The intent is that this will be added to the API in the future.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * @serial
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 19054
diff changeset
   847
     * @since  1.1.6
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
    private  char    exponential;       // Field new in JDK 1.1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
33310
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   851
    /**
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   852
     * The string used to separate the mantissa from the exponent.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   853
     * Examples: "x10^" for 1.23x10^4, "E" for 1.23E4.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   854
     * <p>
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   855
     * If both <code>exponential</code> and <code>exponentialSeparator</code>
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   856
     * exist, this <code>exponentialSeparator</code> has the precedence.
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   857
     *
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   858
     * @serial
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   859
     * @since 1.6
2701a9854bb5 8134720: Lazy initialization support for currency names in DecimalFormatSymbols
naoto
parents: 25859
diff changeset
   860
     */
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
    private  String    exponentialSeparator;       // Field new in JDK 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     * The locale of these currency format symbols.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
    private Locale locale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
    // currency; only the ISO code is serialized.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
    private transient Currency currency;
34774
03b4e6dc367b 8145680: Remove unnecessary explicit initialization of volatile variables in java.base
redestad
parents: 33310
diff changeset
   873
    private transient volatile boolean currencyInitialized;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
    // Proclaim JDK 1.1 FCS compatibility
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
    static final long serialVersionUID = 5772796243397350300L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
    // The internal serial version which says which version was written
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
    // - 0 (default) for version up to JDK 1.1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
    // - 1 for version from JDK 1.1.6, which includes two new fields:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
    //     monetarySeparator and exponential.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    // - 2 for version from J2SE 1.4, which includes locale field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
    // - 3 for version from J2SE 1.6, which includes exponentialSeparator field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
    private static final int currentSerialVersion = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     * Describes the version of <code>DecimalFormatSymbols</code> present on the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * Possible values are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * <li><b>0</b> (or uninitialized): versions prior to JDK 1.1.6.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * <li><b>1</b>: Versions written by JDK 1.1.6 or later, which include
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     *      two new fields: <code>monetarySeparator</code> and <code>exponential</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
     * <li><b>2</b>: Versions written by J2SE 1.4 or later, which include a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     *      new <code>locale</code> field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     * <li><b>3</b>: Versions written by J2SE 1.6 or later, which include a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
     *      new <code>exponentialSeparator</code> field.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * When streaming out a <code>DecimalFormatSymbols</code>, the most recent format
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     * (corresponding to the highest allowable <code>serialVersionOnStream</code>)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * is always written.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * @serial
24865
09b1d992ca72 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
henryjen
parents: 19054
diff changeset
   904
     * @since  1.1.6
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
    private int serialVersionOnStream = currentSerialVersion;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
}