Money

public abstract class Money implements Parcelable


Represents an amount of money with its currency type.

Summary

Nested types

public abstract class Money.Builder

Builder for Money.

Public constructors

Public methods

abstract String

Returns the three-letter currency code defined in ISO 4217.

abstract Integer

Returns the number of nano (1e-9) units of the amount.

abstract Long

Returns the whole units of the amount.

static Money
newInstance(String currencyCode, Long units, Integer nanos)

Creates a Money with currency code, units and nanos.

Inherited Constants

From android.os.Parcelable
static final int
static final int
static final int
static final int

Inherited methods

From android.os.Parcelable
abstract int
int
abstract void
writeToParcel(Parcel p, int p1)

Public constructors

Money

public Money()

Public methods

getCurrencyCode

public abstract String getCurrencyCode()

Returns the three-letter currency code defined in ISO 4217.

getNanos

public abstract Integer getNanos()

Returns the number of nano (1e-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. For example $-1.75 is represented as units=-1 and nanos=-750,000,000.

If "units" is positive, "nanos" must be positive or zero. If "units" is zero, "nanos" can be positive, zero, or negative. If "units" is negative, "nanos" must be negative or zero.

getUnits

public abstract Long getUnits()

Returns the whole units of the amount. For example if "currencyCode" is "USD", then 1 unit is one US dollar.

newInstance

public static Money newInstance(String currencyCode, Long units, Integer nanos)

Creates a Money with currency code, units and nanos.

Parameters
String currencyCode

The three-letter currency code defined in ISO 4217

Long units

The whole units of the amount

Integer nanos

The number of nano (1e-9) units of the amount