public class Cash extends Object implements CurrencyAmount
| Constructor and Description |
|---|
Cash(String currency,
BigDecimal amount) |
| Modifier and Type | Method and Description |
|---|---|
CurrencyAmount |
add(CurrencyAmount money)
Add the amount with the existing one and return a new immutable Money.
|
boolean |
equals(Object obj) |
BigDecimal |
getAmount() |
String |
getCurrency() |
int |
hashCode() |
CurrencyAmount |
negate()
Swap the sign on the amount and return a new immutable Money.
|
static Cash |
of(String currency,
BigDecimal amount) |
static Cash |
of(String currency,
long amount) |
static Cash |
of(String currency,
String amount) |
CurrencyAmount |
subtract(CurrencyAmount money)
Subtract the amount from the existing one and return a new immutable Money.
|
String |
toString() |
public Cash(String currency, BigDecimal amount)
public static Cash of(String currency, BigDecimal amount)
public String getCurrency()
getCurrency in interface CurrencyAmountpublic BigDecimal getAmount()
getAmount in interface CurrencyAmountpublic CurrencyAmount negate()
negate in interface CurrencyAmountpublic CurrencyAmount add(CurrencyAmount money)
add in interface CurrencyAmountIllegalArgumentException - if the money.currency does not match the current one.public CurrencyAmount subtract(CurrencyAmount money)
subtract in interface CurrencyAmountIllegalArgumentException - if the money.currency does not match the current one.Copyright © 2006–2022 Appendium - Portfolio Financing Platform. All rights reserved.