Class CurrencyUtils
java.lang.Object
de.hybris.platform.ruleengineservices.util.CurrencyUtils
The class provides some utility methods related to Currency functionality.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapplyRounding(BigDecimal price, String currencyIsoCode) Applies the scaling and rounding to a given price, based on declared currency codeconvertCurrency(String sourceCurrencyIsoCode, String targetCurrencyIsoCode, BigDecimal sourceValue) Given the source and target currency codes, converts the value from one currency to anotherprotected CommonI18NServicegetCurrency(String currencyCode) Provides an instance ofCurrencyModelfor a given currency codegetDigitsOfCurrency(String currencyIsoCode) Provides number of digits defined for the currency that identifies itself by the provided currency iso codegetDigitsOfCurrencyOrDefault(String currencyIsoCode) Provides number of digits defined for the currency that identifies itself by the provided currency iso codevoidsetCommonI18NService(CommonI18NService commonI18NService)
-
Constructor Details
-
CurrencyUtils
public CurrencyUtils()
-
-
Method Details
-
applyRounding
Applies the scaling and rounding to a given price, based on declared currency code- Parameters:
price- - the value to apply the rounding tocurrencyIsoCode- - currency code- Returns:
- the rounded price
-
convertCurrency
public BigDecimal convertCurrency(String sourceCurrencyIsoCode, String targetCurrencyIsoCode, BigDecimal sourceValue) Given the source and target currency codes, converts the value from one currency to another- Parameters:
sourceCurrencyIsoCode- - source currency codetargetCurrencyIsoCode- - target currency codesourceValue- - the source value to apply the conversion for- Returns:
- the converted value
-
getDigitsOfCurrency
Provides number of digits defined for the currency that identifies itself by the provided currency iso code- Parameters:
currencyIsoCode- currency ISO code- Returns:
- number of digits for the currency identified by the provided currency code
-
getDigitsOfCurrencyOrDefault
Provides number of digits defined for the currency that identifies itself by the provided currency iso code- Parameters:
currencyIsoCode- currency ISO code- Returns:
- number of digits for the currency identified by the provided currency code or default value
-
getCurrency
Provides an instance ofCurrencyModelfor a given currency code- Parameters:
currencyCode- currency code- Returns:
- instance of
CurrencyModelthat matches provided currency code
-
getCommonI18NService
-
setCommonI18NService
-