Class Money
java.lang.Object
org.broadleafcommerce.common.money.Money
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,Comparable<Money>
public class Money
extends Object
implements Serializable, Cloneable, Comparable<Money>, Externalizable
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMoney()
Money
(double amount) Money
(int amount) Money
(long amount) Money
(BigDecimal amount) Money
(BigDecimal amount, String currencyCode) Money
(BigDecimal amount, Currency currency) Money
(BigDecimal amount, Currency currency, int scale) Money
(BigDecimal amount, BroadleafCurrency blCurrency) Money
(BigDecimal amount, BroadleafCurrency blCurrency, int scale) Money
(BigDecimal amount, BroadleafCurrency blCurrency, int scale, RoundingMode roundingMode) Money
(BroadleafCurrency blCurrency) -
Method Summary
Modifier and TypeMethodDescriptionabs()
static Money
clone()
int
compareTo
(BigDecimal value) int
static Currency
Attempts to load a default currency by using the default locale.divide
(double amount) divide
(double amount, RoundingMode roundingMode) divide
(int amount) divide
(int amount, RoundingMode roundingMode) divide
(BigDecimal divisor) divide
(BigDecimal divisor, RoundingMode roundingMode) double
boolean
protected static String
getCurrencyCode
(BroadleafCurrency blCurrency) boolean
greaterThan
(BigDecimal value) boolean
greaterThan
(Money other) boolean
greaterThanOrEqual
(BigDecimal value) boolean
greaterThanOrEqual
(Money other) int
hashCode()
boolean
isZero()
boolean
lessThan
(BigDecimal value) boolean
boolean
lessThanOrEqual
(BigDecimal value) boolean
lessThanOrEqual
(Money other) static Money
static Money
multiply
(double amount) multiply
(int amount) multiply
(BigDecimal multiplier) multiply
(BigDecimal multiplier, RoundingMode roundingMode) multiplyWithRounding
(int inInt, RoundingMode roundingMode) negate()
void
static BigDecimal
static Currency
toCurrency
(Money money) toString()
static Money
void
zero()
static Money
static Money
-
Field Details
-
ZERO
-
-
Constructor Details
-
Money
-
Money
-
Money
-
Money
-
Money
-
Money
public Money() -
Money
-
Money
public Money(double amount) -
Money
public Money(int amount) -
Money
public Money(long amount) -
Money
-
Money
-
Money
-
Money
-
Money
-
Money
-
Money
-
Money
-
Money
-
Money
-
Money
-
Money
-
-
Method Details
-
getCurrencyCode
-
zero
-
zero
-
abs
-
min
-
max
-
toAmount
-
toCurrency
-
defaultCurrency
Attempts to load a default currency by using the default locale.Currency.getInstance(Locale)
uses the country component of the locale to resolve the currency. In some instances, the locale may not have a country component, in which case the default currency can be controlled with a system property.- Returns:
- The default currency to use when none is specified
-
trimUnnecessaryScaleToCurrency
-
getAmount
-
getCurrency
-
add
-
subtract
-
multiply
-
multiply
-
multiplyWithRounding
-
multiply
-
multiply
-
divide
-
divide
-
divide
-
divide
-
divide
-
divide
-
abs
-
min
-
max
-
negate
-
isZero
public boolean isZero() -
zero
-
lessThan
-
lessThan
-
lessThanOrEqual
-
lessThanOrEqual
-
greaterThan
-
greaterThan
-
greaterThanOrEqual
-
greaterThanOrEqual
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Money>
-
compareTo
-
equals
-
hashCode
public int hashCode() -
clone
-
toString
-
doubleValue
public double doubleValue() -
stringValue
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-