@Test public void testNegate() { Money m = Money.of(100, "CHF"); assertEquals(Money.of(-100, "CHF"), m.negate()); m = Money.of(-123.234, "CHF"); assertEquals(Money.of(123.234, "CHF"), m.negate()); }
@Override public Money negate() { return new Money(this.number.negate(), getCurrency()); }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public Money negate() { return new Money(this.number.negate(), getCurrency()); } }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public Money negate() { return new Money(this.number.negate(), getCurrency()); } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public Money negate() { return new Money(this.number.negate(), getCurrency()); } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); @Override CurrencyUnit getCurrency(); @Override MonetaryContext getContext(); @Override NumberValue getNumber(); BigDecimal getNumberStripped(); @Override int compareTo(MonetaryAmount o); @Override Money abs(); @Override Money divide(long divisor); @Override Money divide(double divisor); @Override Money[] divideAndRemainder(long divisor); @Override Money[] divideAndRemainder(double divisor); @Override Money multiply(long multiplicand); @Override Money multiply(double multiplicand); @Override Money remainder(long divisor); @Override Money remainder(double divisor); @Override boolean isZero(); @Override boolean isPositive(); @Override boolean isPositiveOrZero(); @Override boolean isNegative(); @Override boolean isNegativeOrZero(); @Override R query(MonetaryQuery<R> query); @Override Money with(MonetaryOperator operator); @Override Money add(MonetaryAmount amount); @Override Money divide(Number divisor); @Override Money[] divideAndRemainder(Number divisor); @Override Money divideToIntegralValue(long divisor); @Override Money divideToIntegralValue(double divisor); @Override Money divideToIntegralValue(Number divisor); @Override Money multiply(Number multiplicand); @Override Money negate(); @Override Money plus(); @Override Money subtract(MonetaryAmount subtrahend); @Override Money stripTrailingZeros(); @Override Money remainder(Number divisor); @Override Money scaleByPowerOfTen(int power); @Override int signum(); @Override boolean isLessThan(MonetaryAmount amount); @Override boolean isLessThanOrEqualTo(MonetaryAmount amount); @Override boolean isGreaterThan(MonetaryAmount amount); @Override boolean isGreaterThanOrEqualTo(MonetaryAmount amount); @Override boolean isEqualTo(MonetaryAmount amount); @Override MonetaryAmountFactory<Money> getFactory(); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode(); static Money of(BigDecimal number, CurrencyUnit currency); static Money of(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, CurrencyUnit currency); static Money of(Number number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, String currencyCode); static Money of(BigDecimal number, String currencyCode); static Money of(Number number, String currencyCode, MonetaryContext monetaryContext); static Money of(BigDecimal number, String currencyCode, MonetaryContext monetaryContext); static Money zero(CurrencyUnit currency); static Money ofMinor(CurrencyUnit currency, long amountMinor); static Money ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits); static Money from(MonetaryAmount amt); static Money parse(CharSequence text); static Money parse(CharSequence text, MonetaryAmountFormat formatter); @Deprecated static boolean isInfinityAndNotNaN(Number number); @Deprecated static void checkNoInfinityOrNaN(Number number); }
Money implements MonetaryAmount, Comparable<MonetaryAmount>, Serializable { @Override public Money negate() { return new Money(this.number.negate(), getCurrency()); } private  Money(BigDecimal number, CurrencyUnit currency); private  Money(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); @Override CurrencyUnit getCurrency(); @Override MonetaryContext getContext(); @Override NumberValue getNumber(); BigDecimal getNumberStripped(); @Override int compareTo(MonetaryAmount o); @Override Money abs(); @Override Money divide(long divisor); @Override Money divide(double divisor); @Override Money[] divideAndRemainder(long divisor); @Override Money[] divideAndRemainder(double divisor); @Override Money multiply(long multiplicand); @Override Money multiply(double multiplicand); @Override Money remainder(long divisor); @Override Money remainder(double divisor); @Override boolean isZero(); @Override boolean isPositive(); @Override boolean isPositiveOrZero(); @Override boolean isNegative(); @Override boolean isNegativeOrZero(); @Override R query(MonetaryQuery<R> query); @Override Money with(MonetaryOperator operator); @Override Money add(MonetaryAmount amount); @Override Money divide(Number divisor); @Override Money[] divideAndRemainder(Number divisor); @Override Money divideToIntegralValue(long divisor); @Override Money divideToIntegralValue(double divisor); @Override Money divideToIntegralValue(Number divisor); @Override Money multiply(Number multiplicand); @Override Money negate(); @Override Money plus(); @Override Money subtract(MonetaryAmount subtrahend); @Override Money stripTrailingZeros(); @Override Money remainder(Number divisor); @Override Money scaleByPowerOfTen(int power); @Override int signum(); @Override boolean isLessThan(MonetaryAmount amount); @Override boolean isLessThanOrEqualTo(MonetaryAmount amount); @Override boolean isGreaterThan(MonetaryAmount amount); @Override boolean isGreaterThanOrEqualTo(MonetaryAmount amount); @Override boolean isEqualTo(MonetaryAmount amount); @Override MonetaryAmountFactory<Money> getFactory(); @Override boolean equals(Object obj); @Override String toString(); @Override int hashCode(); static Money of(BigDecimal number, CurrencyUnit currency); static Money of(BigDecimal number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, CurrencyUnit currency); static Money of(Number number, CurrencyUnit currency, MonetaryContext monetaryContext); static Money of(Number number, String currencyCode); static Money of(BigDecimal number, String currencyCode); static Money of(Number number, String currencyCode, MonetaryContext monetaryContext); static Money of(BigDecimal number, String currencyCode, MonetaryContext monetaryContext); static Money zero(CurrencyUnit currency); static Money ofMinor(CurrencyUnit currency, long amountMinor); static Money ofMinor(CurrencyUnit currency, long amountMinor, int fractionDigits); static Money from(MonetaryAmount amt); static Money parse(CharSequence text); static Money parse(CharSequence text, MonetaryAmountFormat formatter); @Deprecated static boolean isInfinityAndNotNaN(Number number); @Deprecated static void checkNoInfinityOrNaN(Number number); static final MonetaryContext DEFAULT_MONETARY_CONTEXT; }