Daniele Segato
05/30/2021, 12:24 PMReplaceWith for this:
@Deprecated("Use BigDecimal for prices")
fun Double.formattedWithCurrency(locale: Locale = Constants.LOCALE): String {
return toBigDecimal().formattedWithCurrency(locale)
}
or for this constructor?
@Deprecated("Use the constructor with BigDecimal(s)")
constructor(
originalPrice: Double?,
price: Double,
locale: String,
percentage: Double?
): this(
originalPrice = originalPrice?.toBigDecimal(),
price = price.toBigDecimal(),
locale = locale,
percentage = percentage?.toBigDecimal()
)Nikky
05/30/2021, 1:41 PMReplaceWith("this.toBigDecimal().formattedWithCurrency(locale)")
and hope idea accepts it.. and follow nullablity suggestions afterwardsDaniele Segato
05/31/2021, 7:00 AMNikky
05/31/2021, 7:05 AMClassName(originalPrice = originalPrice?.toBigDecimal(), price = price?.toBigDecimal(), locale = locale, percentage = percentage?.toBigDecimal()) would work
i am not sure on the named arguments and the safecalls still..Daniele Segato
05/31/2021, 7:06 AMDaniele Segato
05/31/2021, 7:08 AMtoBigDecimal() even if you have null so it becomes null?.toBigDecimal() which works but it's kinda stupid ehehDaniele Segato
05/31/2021, 7:23 AMnull?.toBigDecimal() with just null using a shell command, thanks I didn't know ReplaceWith was that smart