You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Checking whether an amount is zero, negative, or positive is quite a common usage scenario and adding helper methods would make this check much easier.
Currently we have to create a zero object and compare the actual value with this.
JavaMoney has some great comparators, like .isZero(), isZeroOrNegative(), etc. (https://github.com/JavaMoney/jsr354-ri/blob/master/src/main/java/org/javamoney/moneta/FastMoney.java)
Would be great if Money type had something similar built in.
i.e.
@Override
public boolean isZero() {
return this.number == 0L;
}
@Override
public boolean isPositive() {
return this.number > 0L;
}
@Override
public boolean isPositiveOrZero() {
return this.number >= 0L;
}
@Override
public boolean isNegative() {
return this.number < 0L;
}
@Override
public boolean isNegativeOrZero() {
return this.number <= 0L;
}
Hi,
Checking whether an amount is zero, negative, or positive is quite a common usage scenario and adding helper methods would make this check much easier.
Currently we have to create a zero object and compare the actual value with this.
JavaMoney has some great comparators, like .isZero(), isZeroOrNegative(), etc. (https://github.com/JavaMoney/jsr354-ri/blob/master/src/main/java/org/javamoney/moneta/FastMoney.java)
Would be great if Money type had something similar built in.
i.e.
BigDecimal implementation is using .signum().
https://github.com/JavaMoney/jsr354-ri/blob/master/src/main/java/org/javamoney/moneta/Money.java
The text was updated successfully, but these errors were encountered: