KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > icu > util > CurrencyAmount


1 /*
2 **********************************************************************
3 * Copyright (c) 2004-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Author: Alan Liu
7 * Created: April 12, 2004
8 * Since: ICU 3.0
9 **********************************************************************
10 */

11 package com.ibm.icu.util;
12
13 import java.lang.Number JavaDoc;
14
15 /**
16  * An amount of currency, consisting of a Number and a Currency.
17  * CurrencyAmount objects are immutable.
18  *
19  * @see java.lang.Number
20  * @see Currency
21  * @author Alan Liu
22  * @stable ICU 3.0
23  */

24 public class CurrencyAmount extends Measure {
25     
26     /**
27      * Constructs a new object given a number and a currency.
28      * @param number the number
29      * @param currency the currency
30      * @stable ICU 3.0
31      */

32     public CurrencyAmount(Number JavaDoc number, Currency currency) {
33         super(number, currency);
34     }
35
36     /**
37      * Constructs a new object given a double value and a currency.
38      * @param number a double value
39      * @param currency the currency
40      * @stable ICU 3.0
41      */

42     public CurrencyAmount(double number, Currency currency) {
43         super(new Double JavaDoc(number), currency);
44     }
45     
46     /**
47      * Returns the currency of this object.
48      * @return this object's Currency
49      * @stable ICU 3.0
50      */

51     public Currency getCurrency() {
52         return (Currency) getUnit();
53     }
54 }
55
Popular Tags