JavaMoney / jsr354-api

JSR 354 - Money and Currency API
http://javamoney.org
Apache License 2.0
357 stars 79 forks source link

MonetaryAmount.stripTrailingZeros() is confusing #114

Open marschall opened 5 years ago

marschall commented 5 years ago

javax.money.MonetaryAmount#stripTrailingZeros() is confusing for two reasons:

It could either be moved to javax.money.NumberValue like #getAmountFractionNumerator() and #getAmountFractionDenominator() or a user could simply do

money.getFactory()
        .setNumber(money.getNumber().numberValueExact(BigDecimal.class).stripTrailingZeros())
        .create();
keilw commented 5 years ago

That's not for now, it could be a possible deprecation / refactoring in new releases.

marschall commented 5 years ago

I understand that changing the ABI may not be an option. What would be nice if we could formalise / specify the behaviour for implementations with a fixed scale.

keilw commented 5 years ago

Maybe it could be configured but only in a future version.