org.broadleafcommerce.common.currency.util
Class BroadleafCurrencyUtils

java.lang.Object
  extended by org.broadleafcommerce.common.currency.util.BroadleafCurrencyUtils

public class BroadleafCurrencyUtils
extends Object

Utility methods for common currency operations

Author:
Phillip Verheyden
See Also:
BroadleafCurrency}

Field Summary
static MathContext ROUND_FLOOR_MATH_CONTEXT
           
 
Constructor Summary
BroadleafCurrencyUtils()
           
 
Method Summary
static int calculateRemainder(Money totalAmount, int quantity)
          Returns the remainder amount if the passed in totalAmount was divided by the quantity taking into account the normal unit of the currency (e.g.
static Currency getCurrency(BroadleafCurrency currency)
           
static Currency getCurrency(Money money)
           
static Money getMoney(BigDecimal amount, BroadleafCurrency currency)
           
static Money getMoney(BroadleafCurrency currency)
           
static Money getUnitAmount(BroadleafCurrency blCurrency)
          Returns the unit amount (e.g.
static Money getUnitAmount(Money difference)
          Returns the unit amount (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUND_FLOOR_MATH_CONTEXT

public static final MathContext ROUND_FLOOR_MATH_CONTEXT
Constructor Detail

BroadleafCurrencyUtils

public BroadleafCurrencyUtils()
Method Detail

getMoney

public static Money getMoney(BigDecimal amount,
                             BroadleafCurrency currency)

getMoney

public static Money getMoney(BroadleafCurrency currency)

getCurrency

public static Currency getCurrency(Money money)

getCurrency

public static Currency getCurrency(BroadleafCurrency currency)

getUnitAmount

public static Money getUnitAmount(Money difference)
Returns the unit amount (e.g. .01 for US and all other 2 decimal currencies)

Parameters:
currency -
Returns:

getUnitAmount

public static Money getUnitAmount(BroadleafCurrency blCurrency)
Returns the unit amount (e.g. .01 for US and all other 2 decimal currencies)

Parameters:
currency -
Returns:

calculateRemainder

public static int calculateRemainder(Money totalAmount,
                                     int quantity)
Returns the remainder amount if the passed in totalAmount was divided by the quantity taking into account the normal unit of the currency (e.g. .01 for US).

Parameters:
currency -
Returns:


Copyright © 2013. All Rights Reserved.