diff --git a/src/main/kotlin/com/cubetiqs/libra/moneyutils/MoneyExtension.kt b/src/main/kotlin/com/cubetiqs/libra/moneyutils/MoneyExtension.kt new file mode 100644 index 0000000..05caf96 --- /dev/null +++ b/src/main/kotlin/com/cubetiqs/libra/moneyutils/MoneyExtension.kt @@ -0,0 +1,3 @@ +package com.cubetiqs.libra.moneyutils + +fun StdMoney \ No newline at end of file diff --git a/src/main/kotlin/com/cubetiqs/libra/moneyutils/MoneyOperator.kt b/src/main/kotlin/com/cubetiqs/libra/moneyutils/MoneyOperator.kt index 83f1bb8..f9a15df 100644 --- a/src/main/kotlin/com/cubetiqs/libra/moneyutils/MoneyOperator.kt +++ b/src/main/kotlin/com/cubetiqs/libra/moneyutils/MoneyOperator.kt @@ -1,13 +1,12 @@ package com.cubetiqs.libra.moneyutils -operator fun Money.unaryMinus() = (-getMoneyValue()) -operator fun Money.unaryPlus() = (+getMoneyValue()) +operator fun StdMoney.unaryMinus() = (-getMoneyValue()) +operator fun StdMoney.unaryPlus() = (+getMoneyValue()) operator fun Money.inc() = Money(value++) operator fun Money.dec() = Money(value--) -operator fun Money.plus(other: Money) = Money(value + other.value) -operator fun Money.times(other: Money) = Money(value * other.value) -operator fun Money.div(other: Money) = Money(value / other.value) -operator fun Money.timesAssign(other: Money) { - this.value = this.value * other.value -} -operator fun Money.not() = this.value != this.value \ No newline at end of file +operator fun StdMoney.plus(other: StdMoney) = Money(getMoneyValue() + other.getMoneyValue()) +operator fun StdMoney.times(other: StdMoney) = Money(getMoneyValue() * other.getMoneyValue()) +operator fun StdMoney.div(other: StdMoney) = Money(getMoneyValue() / other.getMoneyValue()) +operator fun Money.timesAssign(other: StdMoney) { + this.value = this.getMoneyValue() * other.getMoneyValue() +} \ No newline at end of file