Add adavanced money formatter and decimal functions for money format and add function builder and money extension updated and add money view for money module
Add money formatter provider for general provider formatter
This commit is contained in:
26
src/main/kotlin/com/cubetiqs/money/MoneyView.kt
Normal file
26
src/main/kotlin/com/cubetiqs/money/MoneyView.kt
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.cubetiqs.money
|
||||
|
||||
open class MoneyView(
|
||||
private var value: Number? = null,
|
||||
private var currency: String? = null,
|
||||
) : MoneyMixin {
|
||||
constructor(money: StdMoney) : this() {
|
||||
this.value = money.getValue()
|
||||
this.currency = money.getCurrency().getCurrency()
|
||||
}
|
||||
|
||||
fun getValue(): Double {
|
||||
return value?.toDouble() ?: 0.0
|
||||
}
|
||||
|
||||
fun getCurrency(): String? {
|
||||
return currency
|
||||
}
|
||||
|
||||
fun getFormat(): String {
|
||||
return MoneyConfig
|
||||
.getFormatter(getCurrency())
|
||||
.setValue(this.asStdMoney())
|
||||
.format()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user