mirror of
https://github.com/corda/corda.git
synced 2025-02-21 17:56:54 +00:00
Better toString for Amount post-issuer refactoring.
This commit is contained in:
parent
a44d3edebf
commit
309159da14
@ -61,7 +61,7 @@ data class Amount<T>(val quantity: Long, val token: T) : Comparable<Amount<T>> {
|
|||||||
operator fun div(other: Int): Amount<T> = Amount(quantity / other, token)
|
operator fun div(other: Int): Amount<T> = Amount(quantity / other, token)
|
||||||
operator fun times(other: Int): Amount<T> = Amount(Math.multiplyExact(quantity, other.toLong()), token)
|
operator fun times(other: Int): Amount<T> = Amount(Math.multiplyExact(quantity, other.toLong()), token)
|
||||||
|
|
||||||
override fun toString(): String = (BigDecimal(quantity).divide(BigDecimal(100))).setScale(2).toPlainString()
|
override fun toString(): String = (BigDecimal(quantity).divide(BigDecimal(100))).setScale(2).toPlainString() + " " + token
|
||||||
|
|
||||||
override fun compareTo(other: Amount<T>): Int {
|
override fun compareTo(other: Amount<T>): Int {
|
||||||
checkCurrency(other)
|
checkCurrency(other)
|
||||||
|
@ -146,10 +146,9 @@ interface IssuanceDefinition
|
|||||||
*
|
*
|
||||||
* @param P the type of product underlying the definition, for example [Currency].
|
* @param P the type of product underlying the definition, for example [Currency].
|
||||||
*/
|
*/
|
||||||
data class Issued<out P>(
|
data class Issued<out P>(val issuer: PartyAndReference, val product: P) {
|
||||||
val issuer: PartyAndReference,
|
override fun toString() = "$product issued by $issuer"
|
||||||
val product: P
|
}
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A contract state that can have a single owner.
|
* A contract state that can have a single owner.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user