summaryrefslogtreecommitdiff
path: root/android_icu4j/src/main/java/android/icu/util/CurrencyAmount.java
blob: 0a29aeabfaaed21f60efcc91ac6f5ff3357e23c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* GENERATED SOURCE. DO NOT MODIFY. */
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (c) 2004-2010, International Business Machines
* Corporation and others.  All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: April 12, 2004
* Since: ICU 3.0
**********************************************************************
*/
package android.icu.util;


/**
 * An amount of currency, consisting of a Number and a Currency.
 * CurrencyAmount objects are immutable.
 *
 * @see java.lang.Number
 * @see Currency
 * @author Alan Liu
 */
public class CurrencyAmount extends Measure {

    /**
     * Constructs a new object given a number and a currency.
     * @param number the number
     * @param currency the currency
     */
    public CurrencyAmount(Number number, Currency currency) {
        super(number, currency);
    }

    /**
     * Constructs a new object given a double value and a currency.
     * @param number a double value
     * @param currency the currency
     */
    public CurrencyAmount(double number, Currency currency) {
        super(new Double(number), currency);
    }

    /**
     * Constructs a new object given a number and a Java currency.
     * @param number the number
     * @param currency the currency
     */
    public CurrencyAmount(Number number, java.util.Currency currency) {
        this(number, Currency.fromJavaCurrency(currency));
    }

    /**
     * Constructs a new object given a double value and a Java currency.
     * @param number a double value
     * @param currency the currency
     */
    public CurrencyAmount(double number, java.util.Currency currency) {
        this(number, Currency.fromJavaCurrency(currency));
    }

    /**
     * Returns the currency of this object.
     * @return this object's Currency
     */
    public Currency getCurrency() {
        return (Currency) getUnit();
    }
}