java.util.Currency Maven / Gradle / Ivy
/*
This is not an official specification document, and usage is restricted.
NOTICE
(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
Neither this file nor any files generated from it describe a complete
specification, and they may only be used as described below. For
example, no permission is given for you to incorporate this file, in
whole or in part, in an implementation of a Java specification.
Sun Microsystems Inc. owns the copyright in this file and it is provided
to you for informative, as opposed to normative, use. The file and any
files generated from it may be used to generate other informative
documentation, such as a unified set of documents of API signatures for
a platform that includes technologies expressed as Java APIs. The file
may also be used to produce "compilation stubs," which allow
applications to be compiled and validated for such platforms.
Any work generated from this file, such as unified javadocs or compiled
stub files, must be accompanied by this notice in its entirety.
This work corresponds to the API signatures of JSR 219: Foundation
Profile 1.1. In the event of a discrepency between this work and the
JSR 219 specification, which is available at
http://www.jcp.org/en/jsr/detail?id=219, the latter takes precedence.
*/
package java.util;
import java.io.Serializable;
import java.security.AccessController;
import java.security.PrivilegedAction;
/**
* Represents a currency. Currencies are identified by their ISO 4217 currency
* codes. See the
*
* ISO 4217 maintenance agency for more information, including a table of
* currency codes.
*
* The class is designed so that there's never more than one
* Currency
instance for any given currency. Therefore, there's
* no public constructor. You obtain a Currency
instance using
* the getInstance
methods.
*
* @version 1.5, 03/12/05
* @since 1.4
*/
public final class Currency implements Serializable
{
/**
* ISO 4217 currency code for this currency.
*
* @serial
*/
private String currencyCode;
/*
* This hidden constructor does not necessarily correspond to
* a constructor in the original source file -- it keeps javadoc
* from generating an inappropriate default constructor.
*/
private Currency() { }
/**
* Returns the Currency
instance for the given currency code.
*
* @param currencyCode the ISO 4217 code of the currency
* @return the Currency
instance for the given currency code
* @exception NullPointerException if currencyCode
is null
* @exception IllegalArgumentException if currencyCode
is not
* a supported ISO 4217 code.
*/
public static Currency getInstance(String currencyCode) {
return null;
}
/**
* Returns the Currency
instance for the country of the
* given locale. The language and variant components of the locale
* are ignored. The result may vary over time, as countries change their
* currencies. For example, for the original member countries of the
* European Monetary Union, the method returns the old national currencies
* until December 31, 2001, and the Euro from January 1, 2002, local time
* of the respective countries.
*
* The method returns null
for territories that don't
* have a currency, such as Antarctica.
*
* @param locale the locale for whose country a Currency
* instance is needed
* @return the Currency
instance for the country of the given
* locale, or null
* @exception NullPointerException if locale
or its country
* code is null
* @exception IllegalArgumentException if the country of the given locale
* is not a supported ISO 3166 country code.
*/
public static Currency getInstance(Locale locale) {
return null;
}
/**
* Gets the ISO 4217 currency code of this currency.
*
* @return the ISO 4217 currency code of this currency.
*/
public String getCurrencyCode() {
return null;
}
/**
* Gets the symbol of this currency for the default locale.
* For example, for the US Dollar, the symbol is "$" if the default
* locale is the US, while for other locales it may be "US$". If no
* symbol can be determined, the ISO 4217 currency code is returned.
*
* @return the symbol of this currency for the default locale
*/
public String getSymbol() {
return null;
}
/**
* Gets the symbol of this currency for the specified locale.
* For example, for the US Dollar, the symbol is "$" if the specified
* locale is the US, while for other locales it may be "US$". If no
* symbol can be determined, the ISO 4217 currency code is returned.
*
* @param locale the locale for which a display name for this currency is
* needed
* @return the symbol of this currency for the specified locale
* @exception NullPointerException if locale
is null
*/
public String getSymbol(Locale locale) {
return null;
}
/**
* Gets the default number of fraction digits used with this currency.
* For example, the default number of fraction digits for the Euro is 2,
* while for the Japanese Yen it's 0.
* In the case of pseudo-currencies, such as IMF Special Drawing Rights,
* -1 is returned.
*
* @return the default number of fraction digits used with this currency
*/
public int getDefaultFractionDigits() {
return 0;
}
/**
* Returns the ISO 4217 currency code of this currency.
*
* @return the ISO 4217 currency code of this currency
*/
public String toString() {
return null;
}
/**
* Resolves instances being deserialized to a single instance per currency.
*/
private Object readResolve() {
return null;
}
}