data class Amount<T> : Comparable<Amount<T>>Amount represents a positive quantity of some token (currency, asset, etc.), measured in quantity of the smallest representable units. Note that quantity is not necessarily 1/100ths of a currency unit, but are the actual smallest amount used in whatever underlying thing the amount represents.
Amounts of different tokens
TODO: It may make sense to replace this with convenience extensions over the JSR 354 MonetaryAmount interface, in particular for use during calculations. This may also resolve... TODO: Think about how positive-only vs positive-or-negative amounts can be represented in the type system. TODO: Add either a scaling factor, or a variant for use in calculations.
T - the type of the token, for example Currency.| <init> |
Amount(amount: BigDecimal, currency: T)Amount(quantity: Long, token: T)Amount represents a positive quantity of some token (currency, asset, etc.), measured in quantity of the smallest representable units. Note that quantity is not necessarily 1/100ths of a currency unit, but are the actual smallest amount used in whatever underlying thing the amount represents. |
| quantity |
val quantity: Long |
| token |
val token: T |
| compareTo |
fun compareTo(other: Amount<T>): Int |
| div |
operator fun div(other: Long): Amount<T>operator fun div(other: Int): Amount<T> |
| minus |
operator fun minus(other: Amount<T>): Amount<T> |
| plus |
operator fun plus(other: Amount<T>): Amount<T> |
| times |
operator fun times(other: Long): Amount<T>operator fun times(other: Int): Amount<T> |
| toString |
fun toString(): String |
| CASH |
val Amount<Currency>.CASH: StateAn extension property that lets you write 100.DOLLARS.CASH |
| OBLIGATION |
val Amount<Issued<Currency>>.OBLIGATION: State<Currency> |
| STATE |
val Amount<Issued<Currency>>.STATE: StateAn extension property that lets you get a cash state from an issued token, under the NullPublicKey |
| issued by |
infix fun Amount<Currency>.issued by(deposit: PartyAndReference): Amount<Issued<Currency>> |
| issuedBy |
infix fun Amount<Currency>.issuedBy(deposit: PartyAndReference): Amount<Issued<Currency>> |
| times |
operator fun Amount<Currency>.times(other: RatioUnit): Amount<Currency> |