|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.elasticpath.domain.impl.AbstractEpDomainImpl
com.elasticpath.domain.impl.AbstractTransientImpl
com.elasticpath.domain.misc.impl.MoneyImpl
public class MoneyImpl
Represents an amount of money in a particular currency. This class was migrated from EP4.1 and methods should be uncommented as required.
| Field Summary | |
|---|---|
static long |
serialVersionUID
Serial version id. |
| Constructor Summary | |
|---|---|
MoneyImpl()
No-arg Constructor. |
|
MoneyImpl(java.math.BigDecimal amount,
java.util.Currency currency)
Constructor. |
|
| Method Summary | |
|---|---|
Money |
add(Money otherMoney)
Returns a new Money object representing the sum of this object and otherMoney's values. |
int |
compareTo(java.lang.Object object)
Compares this money with the specified object for order. |
java.lang.String |
displaySalePercentage(Money salePrice,
java.util.Locale locale)
Creates a string to display the percentage savings at the specified sale price. |
java.lang.String |
displaySaleSavings(Money salePrice)
Creates a string to display the amount saved at the specified sale price. |
boolean |
equals(java.lang.Object otherMoney)
Returns true if this money object is equal to otherMoney. |
java.math.BigDecimal |
getAmount()
Get the amount of money as a BigDecimal. |
java.util.Currency |
getCurrency()
Get the Currency of the money. |
java.lang.String |
getMoneyValueAndSymbol()
Prints the symbol of the selected currency along with the value. |
boolean |
greaterThan(Money otherMoney)
Returns true if this money object is greater than the specified other money object. |
int |
hashCode()
The hash code for this Money object. |
boolean |
lessThan(Money otherMoney)
Returns true if this money object is less than the specified other money object. |
Money |
multiply(java.math.BigDecimal multiplier)
Return a new Money object whose value is this money object's value times the specified multiplier. |
Money |
multiply(int multiplier)
Return a new Money object whose value is this money object's value times the specified multiplier. |
void |
setCurrency(java.util.Currency currency)
Set the Currency of the money. |
void |
setValue(java.math.BigDecimal amount,
java.util.Currency currency)
Set the value that this object represents. |
void |
setValue(float amount,
java.util.Currency currency)
Set the value that this object represents. |
Money |
subtract(Money otherMoney)
Returns a new Money object representing the the amount of this object less the amount of the otherMoney object. |
java.lang.String |
toString()
Returns string representation of Money objects to facilitate debugging. |
| Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl |
|---|
getElasticPath, setElasticPath |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.elasticpath.domain.EpDomain |
|---|
getElasticPath, setElasticPath |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
public MoneyImpl()
public MoneyImpl(java.math.BigDecimal amount,
java.util.Currency currency)
amount - the amount of moneycurrency - the currency| Method Detail |
|---|
public Money add(Money otherMoney)
Money object representing the sum of this object and otherMoney's values.
add in interface MoneyotherMoney - the Money object whose value is to be added to this object
Money object representing the sum.
public int compareTo(java.lang.Object object)
throws EpDomainException
compareTo in interface java.lang.Comparableobject - the given object
EpDomainException - if the given object is not a Money
public java.lang.String displaySalePercentage(Money salePrice,
java.util.Locale locale)
displaySalePercentage in interface MoneysalePrice - the sale pricelocale - the user's locale
public java.lang.String displaySaleSavings(Money salePrice)
displaySaleSavings in interface MoneysalePrice - the sale price
public boolean equals(java.lang.Object otherMoney)
equals in class java.lang.ObjectotherMoney - the other money object to be compared
public java.math.BigDecimal getAmount()
BigDecimal.
getAmount in interface MoneyBigDecimal amountpublic java.util.Currency getCurrency()
Currency of the money.
getCurrency in interface MoneyCurrencypublic java.lang.String getMoneyValueAndSymbol()
getMoneyValueAndSymbol in interface Moneypublic boolean greaterThan(Money otherMoney)
greaterThan in interface MoneyotherMoney - the other money object
public int hashCode()
hashCode in class java.lang.Objectpublic boolean lessThan(Money otherMoney)
lessThan in interface MoneyotherMoney - the other money object
public Money multiply(java.math.BigDecimal multiplier)
multiply in interface Moneymultiplier - the amount to multiply by
public Money multiply(int multiplier)
multiply in interface Moneymultiplier - the amount to multiply by
public void setCurrency(java.util.Currency currency)
Currency of the money.
setCurrency in interface Moneycurrency - the Currency
public void setValue(java.math.BigDecimal amount,
java.util.Currency currency)
setValue in interface Moneyamount - the amount of money as a BigDecimalcurrency - the money's currency
public void setValue(float amount,
java.util.Currency currency)
setValue in interface Moneyamount - the amount of money as a floatcurrency - the money's currencypublic Money subtract(Money otherMoney)
Money object representing the the amount of this object less the amount of the otherMoney object.
subtract in interface MoneyotherMoney - the Money object whose value is to be subtracted from this object
Money object representing this value less the other object's value.public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||