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 Moneyclone()intcompareTo(BigDecimal value) intstatic CurrencyAttempts 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) doublebooleanprotected static StringgetCurrencyCode(BroadleafCurrency blCurrency) booleangreaterThan(BigDecimal value) booleangreaterThan(Money other) booleangreaterThanOrEqual(BigDecimal value) booleangreaterThanOrEqual(Money other) inthashCode()booleanisZero()booleanlessThan(BigDecimal value) booleanbooleanlessThanOrEqual(BigDecimal value) booleanlessThanOrEqual(Money other) static Moneystatic Moneymultiply(double amount) multiply(int amount) multiply(BigDecimal multiplier) multiply(BigDecimal multiplier, RoundingMode roundingMode) multiplyWithRounding(int inInt, RoundingMode roundingMode) negate()voidstatic BigDecimalstatic CurrencytoCurrency(Money money) toString()static Moneyvoidzero()static Moneystatic 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:
compareToin interfaceComparable<Money>
-
compareTo
-
equals
-
hashCode
public int hashCode() -
clone
-
toString
-
doubleValue
public double doubleValue() -
stringValue
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-