com.ibm.commerce.price.utils

Class MonetaryAmount



  • public class MonetaryAmount
    extends UnitAmount
    A monetary amount.
    • Constructor Summary

      Constructors 
      Constructor and Description
      MonetaryAmount(java.math.BigDecimal aValue, java.lang.String aCurrency)
      MonetaryAmount constructor.
    • 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.
      • 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.