Open slavonnet opened 7 months ago
Hello. I think that trows is not kotlin way
Please add orNull version to all toDecimals parsers. Look to some examples like String.toBooleranOrNull implementation
orNull
toDecimals
String.toBooleranOrNull
for example i create this
fun String.toBigDecimalOrNull (exponentModifier: Long? = null, decimalMode: DecimalMode? = null) : BigDecimal? = runCatching { this.toBigDecimal(exponentModifier, decimalMode) }.getOrNull() fun Byte.toBigDecimalOrNull (exponentModifier: Long? = null, decimalMode: DecimalMode? = null) : BigDecimal? = runCatching { this.toBigDecimal(exponentModifier, decimalMode) }.getOrNull() fun Float.toBigDecimalOrNull (exponentModifier: Long? = null, decimalMode: DecimalMode? = null) : BigDecimal? = runCatching { this.toBigDecimal(exponentModifier, decimalMode) }.getOrNull() fun Double.toBigDecimalOrNull (exponentModifier: Long? = null, decimalMode: DecimalMode? = null) : BigDecimal? = runCatching { this.toBigDecimal(exponentModifier, decimalMode) }.getOrNull() fun Long.toBigDecimalUsingSignificandAndExponentOrNull(exponent: Long, decimalMode: DecimalMode? = null) : BigDecimal? = runCatching { this.toBigDecimalUsingSignificandAndExponent(exponent, decimalMode) }.getOrNull() fun Int.toBigDecimalUsingSignificandAndExponentOrNull(exponent: Long, decimalMode: DecimalMode? = null) : BigDecimal? = runCatching { this.toBigDecimalUsingSignificandAndExponent(exponent, decimalMode) }.getOrNull()
P.S. Please add @Throws to throwable funcs. P.S.S @SharedImmutableDepricated
@Throws
@SharedImmutable
P.P.P.S Intrestiong info from kotlin. not for this issue. Types definitions variants:
T
<T>
<T : Any?>
T?
T & Any
As I mentioned in Issue #253 then orElse and/or orDefault would also make sense.
orElse
orDefault
Hello. I think that trows is not kotlin way
Please add
orNull
version to alltoDecimals
parsers. Look to some examples likeString.toBooleranOrNull
implementationfor example i create this
P.S. Please add
@Throws
to throwable funcs. P.S.S@SharedImmutable
DepricatedP.P.P.S Intrestiong info from kotlin. not for this issue. Types definitions variants:
T
- can be nullable becouse by default<T>
==<T : Any?>
T?
- is nullanleT & Any
- strict non null - new