Better toString for Amount post-issuer refactoring.

This commit is contained in:
Mike Hearn 2016-07-26 20:17:39 +02:00
parent a44d3edebf
commit 309159da14
2 changed files with 4 additions and 5 deletions

View File

@ -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 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 {
checkCurrency(other)

View File

@ -146,10 +146,9 @@ interface IssuanceDefinition
*
* @param P the type of product underlying the definition, for example [Currency].
*/
data class Issued<out P>(
val issuer: PartyAndReference,
val product: P
)
data class Issued<out P>(val issuer: PartyAndReference, val product: P) {
override fun toString() = "$product issued by $issuer"
}
/**
* A contract state that can have a single owner.