01: /*
02: **********************************************************************
03: * Copyright (c) 2004-2006, International Business Machines
04: * Corporation and others. All Rights Reserved.
05: **********************************************************************
06: * Author: Alan Liu
07: * Created: April 12, 2004
08: * Since: ICU 3.0
09: **********************************************************************
10: */
11: package com.ibm.icu.util;
12:
13: import java.lang.Number;
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 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(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: }
|