com.ibm.commerce.price.utils
Class MonetaryAmount

java.lang.Object
  |
  +--com.ibm.commerce.price.utils.UnitAmount
        |
        +--com.ibm.commerce.price.utils.MonetaryAmount

public class MonetaryAmount
extends UnitAmount

A monetary amount.


Constructor Summary
MonetaryAmount(java.math.BigDecimal aValue, java.lang.String aCurrency)
          MonetaryAmount constructor.
 
Method Summary
 MonetaryAmount add(MonetaryAmount aMonetaryAmount)
          Add 2 monetary amounts.
protected  UnitAmount createNewUnitAmount(java.lang.Object aValue, java.lang.String aUnit)
          Create a new monetary amount from the parameters.
 MonetaryAmount divide(java.math.BigDecimal aBigDecimal)
          Divide a monetary amount by a big decimal.
 java.lang.String getCurrency()
          Get the currency of the monetary amount.
 java.math.BigDecimal getValue()
          Get the value of the monetary amount.
 MonetaryAmount multiply(java.math.BigDecimal aBigDecimal)
          Multiply a monetary amount by a big decimal value.
 void setValue(java.math.BigDecimal aValue)
          Set the value of the monetary amount.
 MonetaryAmount subtract(MonetaryAmount aMonetaryAmount)
          Subtract 2 monetary amounts.
 
Methods inherited from class com.ibm.commerce.price.utils.UnitAmount
getUnit, getValueI, setUnit, setValue, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MonetaryAmount

public MonetaryAmount(java.math.BigDecimal aValue,
                      java.lang.String aCurrency)
MonetaryAmount constructor.
Parameters:
aValue - monetary value.
aCurrency - currency.
Method Detail

add

public MonetaryAmount add(MonetaryAmount aMonetaryAmount)
Add 2 monetary amounts.
Parameters:
aMonetaryAmount - the monetary amount to add to this one.
Returns:
a monetary amount representing the sum of the 2 amounts.

createNewUnitAmount

protected UnitAmount createNewUnitAmount(java.lang.Object aValue,
                                         java.lang.String aUnit)
Create a new monetary amount from the parameters.
Overrides:
createNewUnitAmount in class UnitAmount
Parameters:
aValue - The value of the amount.
aUnit - The currency of the amount.
Returns:
The new monetary amount.

divide

public MonetaryAmount divide(java.math.BigDecimal aBigDecimal)
Divide a monetary amount by a big decimal.
Parameters:
aBigDecimal - the value to divide into this one.
Returns:
a monetary amount representing the division of the 2 amounts.

getCurrency

public java.lang.String getCurrency()
Get the currency of the monetary amount.
Returns:
the currency.

getValue

public java.math.BigDecimal getValue()
Get the value of the monetary amount.
Returns:
the value.

multiply

public MonetaryAmount multiply(java.math.BigDecimal aBigDecimal)
Multiply a monetary amount by a big decimal value.
Parameters:
aBigDecimal - the value to multiply to this one.
Returns:
a monetary amount representing the multiplication of the 2 amounts.

setValue

public void setValue(java.math.BigDecimal aValue)
Set the value of the monetary amount.
Parameters:
aValue - the value.

subtract

public MonetaryAmount subtract(MonetaryAmount aMonetaryAmount)
Subtract 2 monetary amounts.
Parameters:
aMonetaryAmount - the monetary amount to subtract from this one.
Returns:
a monetary amount representing the difference of the 2 amounts.