CustomCurrency

Represents a custom currency identified by a code. This object can be used to represent:

  • A currency that is not standardized (e.g., new cryptocurrencies or currencies from unrecognized or partially recognized countries)

  • A standardized currency with enough minor units (i.e., decimal places) to model amounts like exchange rates and fuel prices

Types

Link copied to clipboard

Configuration options for a CustomCurrency used by the Currency.custom method.

Link copied to clipboard

Represents the type of CustomCurrency.

Properties

Link copied to clipboard

The code of the currency.

Link copied to clipboard

The minor units (i.e., the decimal places) of the currency.

Link copied to clipboard

The name of the currency.

Link copied to clipboard

The secondary code of the currency

Link copied to clipboard

The graphical symbol of the currency.

Link copied to clipboard
open val type: CurrencyType

The type of the currency.

Functions

Link copied to clipboard
open operator override fun compareTo(other: Currency): Int
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
infix fun Currency.money(amount: Number): Money

Creates a Money based on this Currency. Example:

infix fun Currency.money(values: Iterable<Number>): Iterable<Money>

Transforms a collection of Number into Money based on this Currency. Calculations using them are rounded using a Rounding strategy configured with RoundingMode.HALF_EVEN.

fun Currency.money(amount: Number, mode: RoundingMode): Money

Creates a Money based on this Currency. Calculations using it are rounded using a Rounding strategy configured with the specified mode.

Transforms a collection of Number into Money based on this Currency. Calculations using them are rounded using a Rounding strategy configured with the specified mode.

Link copied to clipboard

Creates a Money representing the smallest unit of value based on this Currency. Example:

Creates a Money representing the smallest unit of value based on this Currency. Calculations using it are rounded using a Rounding strategy configured with the specified mode.

Link copied to clipboard

Returns a string representation of the object, including all public properties.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Creates a Money based on this Currency with its amount set to zero. Example:

infix fun Currency.zero(mode: RoundingMode): Money

Creates a Money based on this Currency with its amount set to zero. Calculations using it are rounded using a Rounding strategy configured with the specified mode.