com.ibm.icu.util
Class Currency

java.lang.Object
  |
  +--com.ibm.icu.util.Currency
All Implemented Interfaces:
java.io.Serializable

public class Currency
extends java.lang.Object
implements java.io.Serializable

A class encapsulating a currency, as defined by ISO 4217. A Currency object can be created given a Locale or given an ISO 4217 code. Once created, the Currency object can return various data necessary to its proper display:

The DecimalFormat class uses these data to display currencies.

Note: This class deliberately resembles java.util.Currency but it has a completely independent implementation, and adds features not present in the JDK.

Since:
ICU 2.2
Author:
Alan Liu
See Also:
Serialized Form

Method Summary
 java.lang.String getCurrencyCode()
          Returns the ISO 4217 3-letter code for this currency object.
 int getDefaultFractionDigits()
          Returns the number of the number of fraction digits that should be displayed for this currency.
static Currency getInstance(java.util.Locale locale)
          Returns a currency object for the default currency in the given locale.
static Currency getInstance(java.lang.String theISOCode)
          Returns a currency object given an ISO 4217 3-letter code.
 double getRoundingIncrement()
          Returns the rounding increment for this currency, or 0.0 if no rounding is done by this currency.
 java.lang.String getSymbol(java.util.Locale locale)
          Returns the display string for this currency object in the given locale.
 java.lang.String toString()
          Returns the ISO 4217 code for this currency.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static Currency getInstance(java.util.Locale locale)
Returns a currency object for the default currency in the given locale.

getInstance

public static Currency getInstance(java.lang.String theISOCode)
Returns a currency object given an ISO 4217 3-letter code.

getCurrencyCode

public java.lang.String getCurrencyCode()
Returns the ISO 4217 3-letter code for this currency object.

getSymbol

public java.lang.String getSymbol(java.util.Locale locale)
Returns the display string for this currency object in the given locale. For example, the display string for the USD currency object in the en_US locale is "$".

getDefaultFractionDigits

public int getDefaultFractionDigits()
Returns the number of the number of fraction digits that should be displayed for this currency.
Returns:
a non-negative number of fraction digits to be displayed

getRoundingIncrement

public double getRoundingIncrement()
Returns the rounding increment for this currency, or 0.0 if no rounding is done by this currency.
Returns:
the non-negative rounding increment, or 0.0 if none

toString

public java.lang.String toString()
Returns the ISO 4217 code for this currency.
Overrides:
toString in class java.lang.Object


Copyright (c) 2002 IBM Corporation and others.