public class Amount extends Object implements Serializable
A number of monetary units specified by a currency where the currency is explicit or implied.
| Constructor and Description |
|---|
Amount(BigDecimal value,
com.neovisionaries.i18n.CurrencyCode currency)
Instantiates a new amount.
|
Amount(long value,
com.neovisionaries.i18n.CurrencyCode currency)
Instantiates a new amount.
|
Amount(String value,
com.neovisionaries.i18n.CurrencyCode currency)
Instantiates a new amount.
|
| Modifier and Type | Method and Description |
|---|---|
com.neovisionaries.i18n.CurrencyCode |
getCurrency()
Gets the currency code.
|
BigDecimal |
getValue()
Gets the amount value.
|
Amount |
setCurrency(com.neovisionaries.i18n.CurrencyCode currency)
Sets the currency code.
|
Amount |
setValue(BigDecimal value)
Sets the amount value.
|
String |
toString() |
public Amount(BigDecimal value, com.neovisionaries.i18n.CurrencyCode currency)
Instantiates a new amount.
value - the valuecurrency - the currency codepublic Amount(long value, com.neovisionaries.i18n.CurrencyCode currency)
Instantiates a new amount.
value - the monetary value as a longcurrency - the currency codepublic Amount(String value, com.neovisionaries.i18n.CurrencyCode currency)
Instantiates a new amount.
value - the monetary value as a stringcurrency - the currency codeNumberFormatException - if value is not a valid representation of a BigDecimal.public com.neovisionaries.i18n.CurrencyCode getCurrency()
Gets the currency code.
public BigDecimal getValue()
Gets the amount value.
public Amount setCurrency(com.neovisionaries.i18n.CurrencyCode currency)
Sets the currency code.
currency - the new ISO 4217 3A currency codepublic Amount setValue(BigDecimal value)
Sets the amount value.
value - the new valueCopyright © 2014-2016 Konik.io. All Rights Reserved.